Module: sems
Branch: master
Commit: 8f331436ab712808651d63612ff9ededceb4bfd2
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=8f331436ab712808651d63612ff9ededceb4bfd2

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Apr  1 12:22:09 2014 +0200

py_sems: updated to new API, wip, still doesn't compile

---

 apps/py_sems/sip/AmMimeBody.sip       |  133 +++++++++++++++++++++++++++++++++
 apps/py_sems/sip/AmSipDialog.sip      |   22 +++---
 apps/py_sems/sip/PySemsB2ABDialog.sip |    2 +-
 apps/py_sems/sip/PySemsB2BDialog.sip  |    2 +-
 apps/py_sems/sip/PySemsDialog.sip     |    2 +-
 apps/py_sems/sip/py_sems.sbf          |    3 -
 apps/py_sems/sip/py_sems.sip          |    1 +
 7 files changed, 147 insertions(+), 18 deletions(-)

diff --git a/apps/py_sems/sip/AmMimeBody.sip b/apps/py_sems/sip/AmMimeBody.sip
new file mode 100644
index 0000000..5356573
--- /dev/null
+++ b/apps/py_sems/sip/AmMimeBody.sip
@@ -0,0 +1,133 @@
+
+
+
+struct AmContentType
+{
+
+%TypeHeaderCode
+#include "../../../core/AmMimeBody.h"
+%End
+
+  struct Param
+  {
+
+    enum Type {
+      UNPARSED=0,
+      BOUNDARY,
+      OTHER
+    };
+
+    Type   type;
+    string name;
+    string value;
+
+    int parseType();
+  };
+
+  typedef list<Param*> Params;
+
+  int  parse(const string& ct);
+  int  parseParams(const char* c, const char* end);
+
+  void setType(const string& t);
+  void setSubType(const string& st);
+
+  bool isType(const string& t) const;
+  bool isSubType(const string& st) const;
+  bool hasContentType(const string& content_type) const;
+
+  /** get content-type without any parameters */
+  string getStr() const;
+
+  /** get content-type with parameters */
+  string getHdr() const;
+
+  /** Clear and free param list */
+  void clearParams();
+};
+
+
+class AmMimeBody
+{
+
+%TypeHeaderCode
+#include "../../../core/AmMimeBody.h"
+%End
+
+public:
+
+  typedef list<AmMimeBody*>  Parts;
+
+  /** Parse a body (single & multi-part) */
+  int  parse(const string& content_type, 
+            const unsigned char* buf, 
+            unsigned int len);
+
+  /** Set the payload of this body */
+  void setPayload(const unsigned char* buf, unsigned int len);
+
+  /** Set part headers (intended for sub-parts)*/
+  void setHeaders(const string& hdrs);
+
+  /** 
+   * Add a new part to this body, possibly
+   * converting to multi-part if necessary.
+   * @return a pointer to the new empty part.
+   */
+  AmMimeBody* addPart(const string& content_type);
+
+  /** Get content-type without any parameters */
+  string getCTStr() const;
+
+  /** Get content-type with parameters */
+  string getCTHdr() const;
+  
+  /** @return the list of sub-parts */
+  const Parts& getParts() const;
+
+  /** @return the sub-part headers */
+  const string& getHeaders();
+
+  /**
+   * @return a pointer to the payload of this part.
+   *         in case of multi-part, NULL is returned.
+   */
+  const unsigned char* getPayload();
+
+  /**
+   * @return the payload length of this part.
+   *         in case of multi-part, 0 is returned.
+   */
+  unsigned int   getLen();
+
+  /** @return true if no payload assigned and no sub-parts available */
+  bool empty() const;
+
+  /** @return true if this part has the provided content-type */
+  bool isContentType(const string& /* content_type */) const;
+
+  /** 
+   * @return a pointer to a part of the coresponding 
+   *         content-type (if available).
+   *         This could be a pointer to this body.
+   */
+  AmMimeBody* hasContentType(const string& /*content_type*/);
+
+  /** 
+   * @return a const pointer to a part of the coresponding 
+   *         content-type (if available).
+   *         This could be a pointer to this body.
+   */
+  const AmMimeBody* hasContentType(const string& /* content_type*/ ) const;
+
+  /**
+   * Print the body including sub-parts suitable for sending
+   * within the body of a SIP message.
+   */
+  void print(string& /* buf */) const;
+
+  const AmContentType &getContentType();
+  void setContentType(const AmContentType & /*_ct*/);
+  void addPart(const AmMimeBody & /*part*/);
+
+};
diff --git a/apps/py_sems/sip/AmSipDialog.sip b/apps/py_sems/sip/AmSipDialog.sip
index dd9f5b2..64ab76b 100644
--- a/apps/py_sems/sip/AmSipDialog.sip
+++ b/apps/py_sems/sip/AmSipDialog.sip
@@ -26,12 +26,12 @@ public:
 
     string contact_uri;  // pre-calculated contact uri
 
-    string callid;
-    string remote_tag;
-    string local_tag;
+    string getCallid();
+    string getRemoteTag();
+    string getLocalTag();
 
-    string remote_party; // To/From
-    string local_party;  // To/From
+    string getRemoteParty(); // To/From
+    string getLocalParty();  // To/From
 
     int cseq;            // CSeq for next request
     int r_cseq;
@@ -49,23 +49,21 @@ public:
              unsigned int  /* code */, 
              const string& /* reason */,
              const string& /* content_type */,
-             const string& /* body */,
+             const AmMimeBody* /* body */,
              const string& /* hdrs */);
 
     int sendRequest(const string& /* method */, 
                    const string& /* content_type */,
-                   const string& /* body */,
+                   const AmMimeBody* /* body */,
                    const string& /* hdrs */);
     
     int bye();
 
     int cancel();
 
-    int update(const string& /* content_type */,
-              const string& /* body */,
+    int update(const AmMimeBody* /* body */,
               const string& /* hdrs */);
 
-    int reinvite(const string& /* hdrs */,
-                const string& /* content_type */,
-                const string& /* body */);
+    int reinvite(const AmMimeBody* /* body */,
+                const string& /* hdrs */);
 };
diff --git a/apps/py_sems/sip/PySemsB2ABDialog.sip 
b/apps/py_sems/sip/PySemsB2ABDialog.sip
index 29f6926..c7817bb 100644
--- a/apps/py_sems/sip/PySemsB2ABDialog.sip
+++ b/apps/py_sems/sip/PySemsB2ABDialog.sip
@@ -27,7 +27,7 @@ class PySemsB2ABDialog
 
 public:
 
-    AmSipDialog dlg;
+    AmSipDialog* dlg;
 
     PySemsB2ABDialog();
 
diff --git a/apps/py_sems/sip/PySemsB2BDialog.sip 
b/apps/py_sems/sip/PySemsB2BDialog.sip
index 39e1b31..2f3d0b1 100644
--- a/apps/py_sems/sip/PySemsB2BDialog.sip
+++ b/apps/py_sems/sip/PySemsB2BDialog.sip
@@ -8,7 +8,7 @@ class PySemsB2BDialog
 
 public:
 
-    AmSipDialog dlg;
+    AmSipDialog* dlg;
 
     PySemsB2BDialog();
 
diff --git a/apps/py_sems/sip/PySemsDialog.sip 
b/apps/py_sems/sip/PySemsDialog.sip
index dca4206..6dda8bd 100644
--- a/apps/py_sems/sip/PySemsDialog.sip
+++ b/apps/py_sems/sip/PySemsDialog.sip
@@ -8,7 +8,7 @@ class PySemsDialog
 
 public:
 
-    AmSipDialog dlg;
+    AmSipDialog* dlg;
 
     PySemsDialog();
 
diff --git a/apps/py_sems/sip/py_sems.sbf b/apps/py_sems/sip/py_sems.sbf
deleted file mode 100644
index e1aee7d..0000000
--- a/apps/py_sems/sip/py_sems.sbf
+++ /dev/null
@@ -1,3 +0,0 @@
-target = py_sems_lib
-sources = sippy_sems_libcmodule.cpp sippy_sems_libPySemsB2ABEvent.cpp 
sippy_sems_libPySemsB2ABCalleeDialog.cpp sippy_sems_libAmB2ABCalleeSession.cpp 
sippy_sems_libPySemsB2ABDialog.cpp sippy_sems_libAmSessionAudioConnector.cpp 
sippy_sems_libPySemsB2BDialog.cpp sippy_sems_libPySemsDialog.cpp 
sippy_sems_libAmAudioFile.cpp sippy_sems_libAmAudioEvent.cpp 
sippy_sems_libAmEvent.cpp sippy_sems_libAmSipDialog.cpp 
sippy_sems_libAmSipReply.cpp sippy_sems_libAmSipRequest.cpp 
sippy_sems_libstring.cpp
-headers = sipAPIpy_sems_lib.h
diff --git a/apps/py_sems/sip/py_sems.sip b/apps/py_sems/sip/py_sems.sip
index 6685420..cdbef67 100644
--- a/apps/py_sems/sip/py_sems.sip
+++ b/apps/py_sems/sip/py_sems.sip
@@ -9,3 +9,4 @@
 %Include PySemsB2BDialog.sip
 %Include PySemsB2ABDialog.sip
 %Include AmUtils.sip
+%Include AmMimeBody.sip

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to