msg  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msg_internal.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef MSG_INTERNAL_H
26 
27 #define MSG_INTERNAL_H
28 
38 #ifdef MSG_H
39 #error "msg_internal.h" should be included before "msg.h"
40 #endif
41 
42 #include "sofia-sip/msg.h"
43 #include "sofia-sip/msg_addr.h"
44 #include "sofia-sip/msg_buffer.h"
45 
46 #ifndef SU_ALLOC_H
47 #include <sofia-sip/su_alloc.h>
48 #endif
49 
50 SOFIA_BEGIN_DECLS
51 
52 /* ---------------------------------------------------------------------- */
53 /* Types used when handling streaming */
54 
55 typedef struct msg_buffer_s msg_buffer_t;
56 
57 /* ---------------------------------------------------------------------- */
58 
59 struct msg_s {
63  int m_oflags;
67  size_t m_maxsize;
68  size_t m_size;
75  /* Parsing/printing buffer */
76  struct msg_mbuffer_s {
77  char *mb_data;
78  usize_t mb_size;
79  usize_t mb_used;
80  usize_t mb_commit;
81  unsigned mb_eos:1;
82  unsigned :0;
83  } m_buffer[1];
84 
86  size_t m_ssize;
88  unsigned short m_extract_err;
89  /* Internal flags */
90  unsigned m_set_buffer:1;
91  unsigned m_streaming:1;
92  unsigned m_prepared:1;
93  unsigned :0;
94 
98  int m_refs;
101  su_sockaddr_t m_addr[1];
103  int m_errno;
104 };
105 
107 struct msg_buffer_s {
108  char *b_data;
109  size_t b_size;
110  size_t b_used;
111  size_t b_avail;
115 };
116 
118 #define MSG_SSIZE_MAX (USIZE_MAX)
119 
120 /* ---------------------------------------------------------------------- */
121 /* Header-kind predicate functions. */
122 su_inline int msg_is_single(msg_header_t const *h)
123 {
124  return h->sh_class->hc_kind == msg_kind_single;
125 }
126 
127 su_inline int msg_is_prepend(msg_header_t const *h)
128 {
129  return h->sh_class->hc_kind == msg_kind_prepend;
130 }
131 
132 su_inline int msg_is_append(msg_header_t const *h)
133 {
134  return
135  h->sh_class->hc_kind == msg_kind_append ||
136  h->sh_class->hc_kind == msg_kind_apndlist;
137 }
138 
139 su_inline int msg_is_list(msg_header_t const *h)
140 {
141  return h->sh_class->hc_kind == msg_kind_list;
142 }
143 
144 su_inline int msg_is_special(msg_header_t const *h)
145 {
146  return h->sh_class->hc_hash < 0;
147 }
148 
149 SOFIA_END_DECLS
150 
151 #endif /* MSG_INTERNAL_H */

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