msg  1.12.11
msg_internal.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_INTERNAL_H
00026 
00027 #define MSG_INTERNAL_H
00028 
00038 #ifdef MSG_H
00039 #error "msg_internal.h" should be included before "msg.h"
00040 #endif
00041 
00042 #include "sofia-sip/msg.h"
00043 #include "sofia-sip/msg_addr.h"
00044 #include "sofia-sip/msg_buffer.h"
00045 
00046 #ifndef SU_ALLOC_H
00047 #include <sofia-sip/su_alloc.h>
00048 #endif
00049 
00050 SOFIA_BEGIN_DECLS
00051 
00052 /* ---------------------------------------------------------------------- */
00053 /* Types used when handling streaming */
00054 
00055 typedef struct msg_buffer_s msg_buffer_t;
00056 
00057 /* ---------------------------------------------------------------------- */
00058 
00059 struct msg_s {
00060   su_home_t           m_home[1]; 
00062   msg_mclass_t const *m_class;  
00063   int                 m_oflags; 
00065   msg_pub_t          *m_object; 
00067   size_t              m_maxsize;
00068   size_t              m_size;   
00070   msg_header_t       *m_chain;  
00071   msg_header_t      **m_tail;   
00073   msg_payload_t      *m_chunk;  
00075   /* Parsing/printing buffer */
00076   struct msg_mbuffer_s {
00077     char     *mb_data;          
00078     usize_t   mb_size;          
00079     usize_t   mb_used;          
00080     usize_t   mb_commit;        
00081     unsigned  mb_eos:1;         
00082     unsigned :0;
00083   } m_buffer[1];
00084 
00085   msg_buffer_t  *m_stream;      
00086   size_t         m_ssize;       
00088   unsigned short m_extract_err; 
00089   /* Internal flags */
00090   unsigned       m_set_buffer:1;
00091   unsigned       m_streaming:1; 
00092   unsigned       m_prepared:1;  
00093   unsigned  :0;
00094 
00095   msg_t         *m_next;        
00097   msg_t         *m_parent;      
00098   int            m_refs;        
00100   su_addrinfo_t  m_addrinfo;    
00101   su_sockaddr_t  m_addr[1];     
00103   int            m_errno;       
00104 };
00105 
00107 struct msg_buffer_s {
00108   char           *b_data;           
00109   size_t          b_size;           
00110   size_t          b_used;           
00111   size_t          b_avail;          
00112   int             b_complete;       
00113   msg_buffer_t   *b_next;           
00114   msg_payload_t  *b_chunks;         
00115 };
00116 
00117 
00118 struct hep_hdr {
00119     u_int8_t hp_v;             /* version */
00120     u_int8_t hp_l;             /* length */
00121     u_int8_t hp_f;             /* family */
00122     u_int8_t hp_p;             /* protocol */
00123     u_int16_t hp_sport;        /* source port */
00124     u_int16_t hp_dport;        /* destination port */
00125 };
00126 
00127 
00128 struct hep_iphdr {
00129         struct in_addr hp_src;
00130         struct in_addr hp_dst;      /* source and dest address */
00131 };
00132 
00133 #if SU_HAVE_IN6
00134 struct hep_ip6hdr {
00135         struct in6_addr hp6_src;        /* source address */
00136         struct in6_addr hp6_dst;        /* destination address */
00137 };
00138 #endif
00139 
00141 #define MSG_SSIZE_MAX (USIZE_MAX)
00142 
00143 /* ---------------------------------------------------------------------- */
00144 /* Header-kind predicate functions. */
00145 su_inline int msg_is_single(msg_header_t const *h)
00146 {
00147   return h->sh_class->hc_kind == msg_kind_single;
00148 }
00149 
00150 su_inline int msg_is_prepend(msg_header_t const *h)
00151 {
00152   return h->sh_class->hc_kind == msg_kind_prepend;
00153 }
00154 
00155 su_inline int msg_is_append(msg_header_t const *h)
00156 {
00157   return
00158     h->sh_class->hc_kind == msg_kind_append ||
00159     h->sh_class->hc_kind == msg_kind_apndlist;
00160 }
00161 
00162 su_inline int msg_is_list(msg_header_t const *h)
00163 {
00164   return h->sh_class->hc_kind == msg_kind_list;
00165 }
00166 
00167 su_inline int msg_is_special(msg_header_t const *h)
00168 {
00169   return h->sh_class->hc_hash < 0;
00170 }
00171 
00172 SOFIA_END_DECLS
00173 
00174 #endif /* MSG_INTERNAL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

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