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 struct msg_s {
00053   su_home_t           m_home[1]; 
00055   msg_mclass_t const *m_class;  
00056   int                 m_oflags; 
00058   msg_pub_t          *m_object; 
00060   unsigned            m_maxsize;
00061   unsigned            m_size;   
00063   msg_header_t       *m_chain;  
00064   msg_header_t      **m_tail;   
00066   msg_payload_t      *m_chunk;  
00068   /* Parsing/printing buffer */
00069   struct msg_mbuffer_s {
00070     char     *mb_data;          
00071     unsigned  mb_size;          
00072     unsigned  mb_used;          
00073     unsigned  mb_commit;        
00074     unsigned  mb_eos:1;         
00075     unsigned :0;
00076   } m_buffer[1];
00077 
00078   msg_buffer_t  *m_stream;      
00079   unsigned       m_ssize;       
00081   unsigned short m_extract_err; 
00082   /* Internal flags */
00083   unsigned       m_set_buffer:1;
00084   unsigned       m_streaming:1; 
00085   unsigned       m_prepared:1;  
00086   unsigned  :0;
00087 
00088   msg_t         *m_next;        
00090   msg_t         *m_parent;      
00091   int            m_refs;        
00093   su_addrinfo_t  m_addrinfo;    
00094   su_sockaddr_t  m_addr[1];     
00096   int            m_errno;       
00097 };
00098 
00099 static inline int msg_is_single(msg_header_t const *h)
00100 {
00101   return h->sh_class->hc_kind == msg_kind_single;
00102 }
00103 
00104 static inline int msg_is_prepend(msg_header_t const *h)
00105 {
00106   return h->sh_class->hc_kind == msg_kind_prepend;
00107 }
00108 
00109 static inline int msg_is_append(msg_header_t const *h)
00110 {
00111   return 
00112     h->sh_class->hc_kind == msg_kind_append ||
00113     h->sh_class->hc_kind == msg_kind_apndlist;
00114 }
00115 
00116 static inline int msg_is_list(msg_header_t const *h)
00117 {
00118   return h->sh_class->hc_kind == msg_kind_list;
00119 }
00120 
00121 static inline int msg_is_special(msg_header_t const *h)
00122 {
00123   return h->sh_class->hc_hash < 0;
00124 }
00125 
00126 SOFIA_END_DECLS
00127 
00128 #endif /* MSG_INTERNAL_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.