jingle/jingle.h
changeset 137 14ef2cb0bd2b
parent 133 361d8577ebd1
child 138 dde8eaf7ff2c
equal deleted inserted replaced
136:405f99d8f3c5 137:14ef2cb0bd2b
     1 #ifndef __JINGLE_H__
     1 #ifndef __JINGLE_H__
     2 #define __JINGLE_H__ 1
     2 #define __JINGLE_H__ 1
     3 
     3 
       
     4 /*!
       
     5  * \file jingle.h
       
     6  * \brief Lecteur de musique de base
       
     7  * \author Nicolas Cornu
       
     8  * \version 0.1
       
     9  */
       
    10 
     4 #include <glib.h>
    11 #include <glib.h>
     5 #include <loudmouth/loudmouth.h>
    12 #include <loudmouth/loudmouth.h>
     6 
    13 
     7 
    14 
     8 #define NS_JINGLE "urn:xmpp:jingle:1"
    15 #define NS_JINGLE "urn:xmpp:jingle:1"
     9 #define NS_JINGLE_ERRORS "urn:xmpp:jingle:errors:1"
    16 #define NS_JINGLE_ERRORS "urn:xmpp:jingle:errors:1"
    10 
    17 
    11 
    18 /**
       
    19  * \enum JingleAction
       
    20  * \brief Jingle actions constants
       
    21  */
    12 typedef enum {
    22 typedef enum {
    13   JINGLE_UNKNOWN_ACTION,
    23   JINGLE_UNKNOWN_ACTION,
    14   JINGLE_CONTENT_ACCEPT,
    24   JINGLE_CONTENT_ACCEPT,
    15   JINGLE_CONTENT_ADD,
    25   JINGLE_CONTENT_ADD,
    16   JINGLE_CONTENT_MODIFY,
    26   JINGLE_CONTENT_MODIFY,
    68   GSList *content;
    78   GSList *content;
    69 
    79 
    70 } JingleNode;
    80 } JingleNode;
    71 
    81 
    72 typedef struct {
    82 typedef struct {
    73   /* pointer to the <content> element */
    83   /**
       
    84    * pointer to the <content> element
       
    85    */
    74   LmMessageNode *node;
    86   LmMessageNode *node;
    75 
    87 
    76   /* which party originally generated the content type.
    88   /** which party originally generated the content type.
    77    * the defined values are "initiator" and "responder"
    89    * the defined values are "initiator" and "responder"
    78    * (where the default is "initiator"). required. */
    90    * (where the default is "initiator"). required.
       
    91    */
    79   JingleCreator creator;
    92   JingleCreator creator;
    80 
    93 
    81   /* how the content definition is to be interpreted by the recipient.
    94   /** how the content definition is to be interpreted by the recipient.
    82    * optional, the default value is "session". */
    95    * optional, the default value is "session".
       
    96    */
    83   const gchar *disposition; // optional, default=session
    97   const gchar *disposition; // optional, default=session
    84 
    98 
    85   /* A unique name or identifier for the content type
    99   /**
    86    * according to the creator. required.*/
   100    * A unique name or identifier for the content type
       
   101    * according to the creator. required.
       
   102    */
    87   const gchar *name;
   103   const gchar *name;
    88 
   104 
    89   /* which parties in the session will be generating content.
   105   /**
       
   106    * which parties in the session will be generating content.
    90    * allowable values are both, initiator, none, responder.
   107    * allowable values are both, initiator, none, responder.
    91    * default is both.
   108    * default is both.
    92    * required for content-modify, optional otherwise */
   109    * required for content-modify, optional otherwise
       
   110    */
    93   JingleSenders senders;
   111   JingleSenders senders;
    94 
   112 
    95   /* each content element (must) contain one description
   113   /**
       
   114    * each content element (must) contain one description
    96    * child element that specifies a desired application.
   115    * child element that specifies a desired application.
    97    * the connt of this node is app specific. */
   116    * the connt of this node is app specific.
       
   117    */
    98   LmMessageNode *description;
   118   LmMessageNode *description;
    99 
   119 
   100   /* each content element (must) contain one transport
   120   /**
       
   121    * each content element (must) contain one transport
   101    * child element that specifies a potential transport
   122    * child element that specifies a potential transport
   102    * method */
   123    * method
       
   124    */
   103   LmMessageNode *transport;
   125   LmMessageNode *transport;
   104 } JingleContent;
   126 } JingleContent;
   105 
   127 
   106 struct JingleActionList {
   128 struct JingleActionList {
   107   const gchar  *name;
   129   const gchar  *name;
   114 } JingleAckType;
   136 } JingleAckType;
   115 
   137 
   116 typedef void (*JingleAckCallback) (JingleAckType type, LmMessage *, gpointer);
   138 typedef void (*JingleAckCallback) (JingleAckType type, LmMessage *, gpointer);
   117 
   139 
   118 typedef struct {
   140 typedef struct {
   119   /* function to be called when we receive a response to the IQ */
   141   /**
       
   142    * function to be called when we receive a response to the IQ
       
   143    */
   120   JingleAckCallback callback;
   144   JingleAckCallback callback;
   121 
   145 
   122   /* additional data to pass to callback */
   146   /**
       
   147    * additional data to pass to callback
       
   148    */
   123   gpointer *user_data;
   149   gpointer *user_data;
   124 
   150 
   125   /* if no response was received after timeout seconds, callback
   151   /** 
   126    * will be called with JINGLE_ACK_TIMEOUT as type */
   152    * if no response was received after timeout seconds, callback
       
   153    * will be called with JINGLE_ACK_TIMEOUT as type
       
   154    */
   127   guint timeout;
   155   guint timeout;
   128 
   156 
   129   /* (private) date at which the handler was inserted using 
   157   /**
   130    * jingle_new_ack_handler */
   158    * \private
       
   159    * 
       
   160    * date at which the handler was inserted using 
       
   161    * jingle_new_ack_handler
       
   162    */
   131   time_t _inserted;
   163   time_t _inserted;
   132   
   164   
   133   /* (private) a pointer to the LmMessageHandler created
   165   /**
   134    * using jingle_new_ack_handler */
   166    * \private
       
   167    * 
       
   168    * a pointer to the LmMessageHandler created
       
   169    * using jingle_new_ack_handler
       
   170    */
   135   LmMessageHandler *_handler;
   171   LmMessageHandler *_handler;
   136 } JingleAckHandle;
   172 } JingleAckHandle;
   137 
   173 
   138 typedef struct {
   174 typedef struct {
   139   const gchar *sid;
   175   const gchar *sid;