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_TYPES_H
00039 #include <sofia-sip/su_types.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 typedef struct msg_auth_info_s      msg_auth_info_t;
00104 
00105 #define MSG_HEADER_N 16377
00106 
00111 struct msg_common_s {
00112   msg_header_t       *h_succ;   
00113   msg_header_t      **h_prev;   
00114   msg_hclass_t       *h_class;  
00115   void const         *h_data;   
00116   usize_t             h_len;    
00117 };
00118 
00119 
00121 struct msg_pub_s {
00122   msg_common_t        msg_common[1]; 
00123   msg_pub_t          *msg_next;
00124   void               *msg_user;
00125   unsigned            msg_size;
00126   unsigned            msg_flags;
00127   msg_error_t        *msg_error;
00128   msg_header_t       *msg_request;
00129   msg_header_t       *msg_status;
00130   msg_header_t       *msg_headers[MSG_HEADER_N];
00131 };
00132 
00133 #define msg_ident msg_common->h_class
00134 
00139 struct msg_numeric_s {
00140   msg_common_t   x_common[1];       
00141   msg_numeric_t *x_next;            
00142   unsigned long  x_value;           
00143 };
00144 
00150 struct msg_generic_s {
00151   msg_common_t   g_common[1];       
00152   msg_generic_t *g_next;            
00153   char const    *g_string;          
00154 };
00155 
00160 struct msg_list_s {
00161   msg_common_t       k_common[1];   
00162   msg_list_t        *k_next;        
00163   msg_param_t       *k_items;       
00164 };
00165 
00171 struct msg_auth_s {
00172   msg_common_t       au_common[1];  
00173   msg_auth_t        *au_next;       
00174   char const        *au_scheme;     
00175   msg_param_t const *au_params;     
00176 };
00177 
00182 struct msg_auth_info_s
00183 {
00184   msg_common_t        ai_common[1]; 
00185   msg_error_t        *ai_next;      
00186   msg_param_t const  *ai_params;    
00187 };
00188 
00190 struct msg_unknown_s {
00191   msg_common_t    un_common[1];  
00192   msg_unknown_t  *un_next;       
00193   char const     *un_name;       
00194   char const     *un_value;      
00195 };
00196 
00198 struct msg_error_s {
00199   msg_common_t    er_common[1];  
00200   msg_error_t    *er_next;       
00201   char const     *er_name;       
00202 };
00203 
00204 
00206 struct msg_separator_s {
00207   msg_common_t    sep_common[1]; 
00208   msg_error_t    *sep_next;      
00209   char            sep_data[4];   
00210 };
00211 
00213 struct msg_payload_s {
00214   msg_common_t    pl_common[1];     
00215   msg_payload_t  *pl_next;          
00216   char           *pl_data;          
00217   usize_t         pl_len;           
00218 };
00219 
00221 union msg_header_u {
00222   msg_common_t    sh_common[1];     
00223   struct {
00224     msg_common_t  shn_common;
00225     msg_header_t *shn_next;
00226   }               sh_header_next[1];
00227 #define sh_next   sh_header_next->shn_next
00228 #define sh_class  sh_common->h_class
00229 #define sh_succ   sh_common->h_succ
00230 #define sh_prev   sh_common->h_prev
00231 #define sh_data   sh_common->h_data
00232 #define sh_len    sh_common->h_len
00233 
00234   msg_generic_t   sh_generic[1];
00235   msg_numeric_t   sh_numeric[1];
00236   msg_list_t      sh_list[1];
00237   msg_auth_t      sh_auth[1];
00238   msg_separator_t sh_separator[1];
00239   msg_payload_t   sh_payload[1];
00240   msg_unknown_t   sh_unknown[1];
00241   msg_error_t     sh_error[1];
00242 };
00243 
00244 /* ====================================================================== */
00245 
00249 typedef enum {
00250   msg_kind_single,              
00251   msg_kind_append,              
00252   msg_kind_list,                
00254   msg_kind_apndlist,            
00255   msg_kind_prepend              
00256 } msg_header_kind_t;
00257 
00258 struct su_home_s;
00259 
00260 typedef issize_t msg_parse_f(struct su_home_s *, msg_header_t *, char *, isize_t);
00261 typedef issize_t msg_print_f(char buf[], isize_t bufsiz, 
00262                              msg_header_t const *, int flags);
00263 typedef char *msg_dup_f(msg_header_t *dst, msg_header_t const *src, 
00264                         char *buf, isize_t bufsiz);
00265 typedef isize_t msg_xtra_f(msg_header_t const *h, isize_t offset);
00266 
00267 typedef int msg_update_f(msg_common_t *, char const *name, isize_t namelen,
00268                          char const *value);
00269 
00277 struct msg_hclass_s
00278 {
00279   /* XXX size of header class missing. Someone has saved bits in wrong place. */
00280   int               hc_hash;    
00281   msg_parse_f      *hc_parse;   
00282   msg_print_f      *hc_print;   
00283   msg_xtra_f       *hc_dxtra;   
00284   msg_dup_f        *hc_dup_one; 
00285   msg_update_f     *hc_update;  
00286   char const       *hc_name;    
00287   short             hc_len;     
00288   char              hc_short[2];
00289   unsigned char     hc_size;    
00290   unsigned char     hc_params;  
00291   unsigned          hc_kind:3;  
00293   unsigned          hc_critical:1; 
00294   unsigned          /*pad*/:0;
00295 };
00296 
00297 #define HC_LEN_MAX SHRT_MAX
00298 
00299 SOFIA_END_DECLS
00300 
00301 #endif /* !defined MSG_TYPES_H */

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