sofia-sip/msg_types.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef MSG_TYPES_H
00026 
00027 #define MSG_TYPES_H
00028 
00038 #ifndef SU_CONFIG_H
00039 #include <sofia-sip/su_config.h>
00040 #endif
00041 
00042 SOFIA_BEGIN_DECLS
00043 
00045 typedef struct msg_mclass_s       msg_mclass_t;
00046 
00048 typedef struct msg_hclass_s const msg_hclass_t;
00049 
00051 typedef struct msg_href_s         msg_href_t;
00052 
00054 typedef struct msg_s              msg_t;
00055 
00056 #ifndef MSG_TIME_T_DEFINED
00057 #define MSG_TIME_T_DEFINED
00058 
00059 typedef unsigned long msg_time_t;
00060 #endif
00061 
00062 #ifndef MSG_TIME_MAX
00063 
00064 #define MSG_TIME_MAX ((msg_time_t)ULONG_MAX)
00065 #endif
00066 
00067 #ifndef MSG_PUB_T
00068 #ifdef MSG_OBJ_T 
00069 #define MSG_PUB_T MSG_OBJ_T
00070 #else
00071 #define MSG_PUB_T struct msg_pub_s
00072 #endif
00073 #endif
00074 
00081 typedef MSG_PUB_T msg_pub_t;
00082 
00083 #ifndef MSG_HDR_T
00084 #define MSG_HDR_T union msg_header_u
00085 #endif
00086 
00087 typedef MSG_HDR_T msg_header_t;
00088 
00089 typedef struct msg_common_s         msg_common_t;
00090 
00091 typedef struct msg_separator_s      msg_separator_t;
00092 typedef struct msg_payload_s        msg_payload_t;
00093 typedef struct msg_unknown_s        msg_unknown_t;
00094 typedef struct msg_error_s          msg_error_t;
00095 
00096 typedef msg_common_t msg_frg_t;
00097 
00098 typedef char const                 *msg_param_t;
00099 typedef struct msg_numeric_s        msg_numeric_t;
00100 typedef struct msg_generic_s        msg_generic_t;
00101 typedef struct msg_list_s           msg_list_t;
00102 typedef struct msg_auth_s           msg_auth_t;
00103 
00104 #define MSG_HEADER_N 16377
00105 
00110 struct msg_common_s {
00111   msg_header_t       *h_succ;   
00112   msg_header_t      **h_prev;   
00113   msg_hclass_t       *h_class;  
00114   void const         *h_data;   
00115   unsigned            h_len;    
00116 };
00117 
00118 
00120 struct msg_pub_s {
00121   msg_common_t        msg_common[1]; 
00122   msg_pub_t          *msg_next;
00123   void               *msg_user;
00124   unsigned            msg_size;
00125   unsigned            msg_flags;
00126   msg_error_t        *msg_error;
00127   msg_header_t       *msg_request;
00128   msg_header_t       *msg_status;
00129   msg_header_t       *msg_headers[MSG_HEADER_N];
00130 };
00131 
00132 #define msg_ident msg_common->h_class
00133 
00138 struct msg_numeric_s {
00139   msg_common_t   x_common[1];       
00140   msg_numeric_t *x_next;            
00141   unsigned long  x_value;           
00142 };
00143 
00149 struct msg_generic_s {
00150   msg_common_t   g_common[1];       
00151   msg_generic_t *g_next;            
00152   char const    *g_string;          
00153 };
00154 
00159 struct msg_list_s {
00160   msg_common_t       k_common[1];   
00161   msg_list_t        *k_next;        
00162   msg_param_t       *k_items;       
00163 };
00164 
00170 struct msg_auth_s {
00171   msg_common_t       au_common[1];  
00172   msg_auth_t        *au_next;       
00173   char const        *au_scheme;     
00174   msg_param_t const *au_params;     
00175 };
00176 
00178 struct msg_unknown_s {
00179   msg_common_t    un_common[1];  
00180   msg_unknown_t  *un_next;       
00181   char const     *un_name;       
00182   char const     *un_value;      
00183 };
00184 
00186 struct msg_error_s {
00187   msg_common_t    er_common[1];  
00188   msg_error_t    *er_next;       
00189   char const     *er_name;       
00190 };
00191 
00192 
00194 struct msg_separator_s {
00195   msg_common_t    sep_common[1]; 
00196   msg_error_t    *sep_next;      
00197   char            sep_data[4];   
00198 };
00199 
00201 struct msg_payload_s {
00202   msg_common_t    pl_common[1];     
00203   msg_payload_t  *pl_next;          
00204   char           *pl_data;          
00205   unsigned        pl_len;           
00206 };
00207 
00209 union msg_header_u {
00210   msg_common_t    sh_common[1];     
00211   struct {
00212     msg_common_t  shn_common;
00213     msg_header_t *shn_next;
00214   }               sh_header_next[1];
00215 #define sh_next   sh_header_next->shn_next
00216 #define sh_class  sh_common->h_class
00217 #define sh_succ   sh_common->h_succ
00218 #define sh_prev   sh_common->h_prev
00219 #define sh_data   sh_common->h_data
00220 #define sh_len    sh_common->h_len
00221 
00222   msg_generic_t   sh_generic[1];
00223   msg_numeric_t   sh_numeric[1];
00224   msg_list_t      sh_list[1];
00225   msg_auth_t      sh_auth[1];
00226   msg_separator_t sh_separator[1];
00227   msg_payload_t   sh_payload[1];
00228   msg_unknown_t   sh_unknown[1];
00229   msg_error_t     sh_error[1];
00230 };
00231 
00232 /* ====================================================================== */
00233 /* Types used when handling streaming */
00234 
00235 typedef struct msg_buffer_s msg_buffer_t;
00236 
00238 struct msg_buffer_s {
00239   char           *b_data;           
00240   unsigned        b_size;           
00241   unsigned        b_used;           
00242   unsigned        b_avail;          
00243   unsigned        b_complete;       
00244   msg_buffer_t   *b_next;           
00245   msg_payload_t  *b_chunks;         
00246 };
00247 
00248 #define MSG_SSIZE_MAX (UINT_MAX)
00249 
00250 /* ====================================================================== */
00251 
00255 typedef enum {
00256   msg_kind_single,              
00257   msg_kind_append,              
00258   msg_kind_list,                
00260   msg_kind_apndlist,            
00261   msg_kind_prepend              
00262 } msg_header_kind_t;
00263 
00264 struct su_home_s;
00265 
00266 typedef int msg_parse_f(struct su_home_s *, msg_header_t *, char *, int);
00267 typedef int msg_print_f(char buf[], int bufsiz, 
00268                         msg_header_t const *, int flags);
00269 typedef char *msg_dup_f(msg_header_t *dst, msg_header_t const *src, 
00270                         char *buf, int bufsiz);
00271 typedef int msg_xtra_f(msg_header_t const *h, int offset);
00272 
00273 typedef int msg_update_f(msg_common_t *, char const *name, int namelen,
00274                          char const *value);
00275 
00283 struct msg_hclass_s
00284 {
00285   int               hc_hash;    
00286   msg_parse_f      *hc_parse;   
00287   msg_print_f      *hc_print;   
00288   msg_xtra_f       *hc_dxtra;   
00289   msg_dup_f        *hc_dup_one; 
00290   msg_update_f     *hc_update;  
00291   char const       *hc_name;    
00292   short             hc_len;     
00293   char              hc_short[2];
00294   unsigned char     hc_size;    
00295   unsigned char     hc_params;  
00296   unsigned /* msg_header_kind_t */
00297                     hc_kind:3;  
00299   unsigned          hc_critical:1; 
00300   unsigned          /*pad*/:0;
00301 };
00302 
00303 /* ====================================================================== */
00304 /* Deprecated types */
00305 
00307 typedef struct msg_s msg_ref_t;
00309 typedef msg_pub_t msg_obj_t;    
00311 typedef MSG_HDR_T msg_hdr_t;
00312 
00313 SOFIA_END_DECLS
00314 
00315 #endif /* !defined MSG_TYPES_H */

Sofia-SIP 1.12.1 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.