jingle/jingle.h
changeset 144 efc92c939fef
parent 138 dde8eaf7ff2c
child 148 cb40539b88b7
equal deleted inserted replaced
143:cd97a18dd0b9 144:efc92c939fef
       
     1 /**
       
     2  * @file jingle.h
       
     3  * @brief jingle.c header file
       
     4  * @author Nicolas Cornu
       
     5  * @version 0.1
       
     6  */
       
     7 
     1 #ifndef __JINGLE_H__
     8 #ifndef __JINGLE_H__
     2 #define __JINGLE_H__ 1
     9 #define __JINGLE_H__ 1
     3 
    10 
     4 /**
       
     5  * \file jingle.h
       
     6  * \brief 
       
     7  * \author Nicolas Cornu
       
     8  * \version 0.1
       
     9  */
       
    10 
       
    11 #include <glib.h>
    11 #include <glib.h>
    12 #include <loudmouth/loudmouth.h>
    12 #include <loudmouth/loudmouth.h>
    13 
    13 
    14 
    14 
       
    15 /** Jingle namespace */
    15 #define NS_JINGLE "urn:xmpp:jingle:1"
    16 #define NS_JINGLE "urn:xmpp:jingle:1"
       
    17 /** Jingle Errors namespace */
    16 #define NS_JINGLE_ERRORS "urn:xmpp:jingle:errors:1"
    18 #define NS_JINGLE_ERRORS "urn:xmpp:jingle:errors:1"
    17 
    19 
    18 /**
    20 /**
    19  * \enum JingleAction
    21  * @enum JingleAction
    20  * \brief Jingle actions constants
    22  * @brief Jingle actions constants
    21  */
    23  */
    22 typedef enum {
    24 typedef enum {
    23   JINGLE_UNKNOWN_ACTION,
    25   JINGLE_UNKNOWN_ACTION,
    24   JINGLE_CONTENT_ACCEPT,
    26   JINGLE_CONTENT_ACCEPT,
    25   JINGLE_CONTENT_ADD,
    27   JINGLE_CONTENT_ADD,
    48   JINGLE_SENDERS_INITIATOR,
    50   JINGLE_SENDERS_INITIATOR,
    49   JINGLE_SENDERS_NONE,
    51   JINGLE_SENDERS_NONE,
    50   JINGLE_SENDERS_RESPONDER,
    52   JINGLE_SENDERS_RESPONDER,
    51 } JingleSenders;
    53 } JingleSenders;
    52 
    54 
    53 typedef struct {
    55 /**
    54   /* pointer to the original LmMessage */
    56  * @struct JingleNode
       
    57  * @brief Represent an incoming jingle IQ
       
    58  * 
       
    59  * This struct is used to represent an incoming jingle IQ.
       
    60  * It should be destroyed as soon as it is not needed using #jingle_free_jinglenode
       
    61  */
       
    62 typedef struct {
       
    63   /**
       
    64    * @brief Pointer to the original LmMessage
       
    65    */
    55   LmMessage *message;
    66   LmMessage *message;
    56 
    67 
    57   /* pointer to the <jingle> element */
    68   /**
       
    69    * @brief Pointer to the <jingle> element
       
    70    */
    58   LmMessageNode *node;
    71   LmMessageNode *node;
    59 
    72 
    60   /* action attribute */
    73   /**
       
    74    * @brief Jingle action of the incoming IQ
       
    75    */
    61   JingleAction action;
    76   JingleAction action;
    62 
    77 
    63   /* full JID of the entity that has initiated the session flow.
    78   /**
    64    * may be different from the 'from' address on the IQ-set of the
    79    * @brief Full JID of the entity that has initiated the session flow
       
    80    * 
       
    81    * May be different from the 'from' address on the IQ-set of the
    65    * session-initiate message.
    82    * session-initiate message.
    66    * recommended for session-initiate, not recommended otherwise. */
    83    * recommended for session-initiate, not recommended otherwise.
       
    84    */
    67   const gchar *initiator;
    85   const gchar *initiator;
    68 
    86 
    69   /* full JID of the entity that has replied to the initation.
    87   /**
    70    * can be different from the 'to' address on the IQ-set.
    88    * @brief Full JID of the entity that has replied to the initation.
    71    * recommended for session-accept, not recommended otherwise. */
    89    * 
       
    90    * Can be different from the 'to' address on the IQ-set.
       
    91    * recommended for session-accept, not recommended otherwise.
       
    92    */
    72   const gchar *responder;
    93   const gchar *responder;
    73 
    94 
    74   /* Random session identifier generated by the initator. */
    95   /**
       
    96    * @brief Random session identifier generated by the initator
       
    97    */
    75   const gchar *sid;
    98   const gchar *sid;
    76 
    99 
    77   /* Linked list of JingleContent. */
   100   /**
       
   101    * @brief Linked list of JingleContent.
       
   102    */
    78   GSList *content;
   103   GSList *content;
    79 
   104 
    80 } JingleNode;
   105 } JingleNode;
    81 
   106 
    82 typedef struct {
   107 /**
    83   /**
   108  * @struct JingleContent
    84    * pointer to the <content> element
   109  * @brief Struct used to represent a <content> element of an incoming Jingle IQ
       
   110  */
       
   111 typedef struct {
       
   112   /**
       
   113    * @brief pointer to the <content> element
    85    */
   114    */
    86   LmMessageNode *node;
   115   LmMessageNode *node;
    87 
   116 
    88   /** which party originally generated the content type.
   117   /**
       
   118    * which party originally generated the content type.
    89    * the defined values are "initiator" and "responder"
   119    * the defined values are "initiator" and "responder"
    90    * (where the default is "initiator"). required.
   120    * (where the default is "initiator"). required.
    91    */
   121    */
    92   JingleCreator creator;
   122   JingleCreator creator;
    93 
   123 
    94   /** how the content definition is to be interpreted by the recipient.
   124   /**
       
   125    * how the content definition is to be interpreted by the recipient.
    95    * optional, the default value is "session".
   126    * optional, the default value is "session".
    96    */
   127    */
    97   const gchar *disposition; // optional, default=session
   128   const gchar *disposition; // optional, default=session
    98 
   129 
    99   /**
   130   /**
   123    * method
   154    * method
   124    */
   155    */
   125   LmMessageNode *transport;
   156   LmMessageNode *transport;
   126 } JingleContent;
   157 } JingleContent;
   127 
   158 
       
   159 /**
       
   160  * @struct JingleActionList
       
   161  * 
       
   162  * Represent a jingle action and the "handler"
       
   163  * (defined in action-handlers.c) for that action.
       
   164  */
   128 struct JingleActionList {
   165 struct JingleActionList {
   129   const gchar  *name;
   166   const gchar  *name;
   130   void (*handler)(JingleNode *);
   167   void (*handler)(JingleNode *);
   131 };
   168 };
   132 
   169 
   153    * will be called with JINGLE_ACK_TIMEOUT as type
   190    * will be called with JINGLE_ACK_TIMEOUT as type
   154    */
   191    */
   155   guint timeout;
   192   guint timeout;
   156 
   193 
   157   /**
   194   /**
   158    * \private
   195    * @private
   159    * 
   196    * 
   160    * date at which the handler was inserted using 
   197    * date at which the handler was inserted using 
   161    * jingle_new_ack_handler
   198    * jingle_new_ack_handler
   162    */
   199    */
   163   time_t _inserted;
   200   time_t _inserted;
   164   
   201   
   165   /**
   202   /**
   166    * \private
   203    * @private
   167    * 
   204    * 
   168    * a pointer to the LmMessageHandler created
   205    * a pointer to the LmMessageHandler created
   169    * using jingle_new_ack_handler
   206    * using jingle_new_ack_handler
   170    */
   207    */
   171   LmMessageHandler *_handler;
   208   LmMessageHandler *_handler;