msg 1.12.11devel
Loading...
Searching...
No Matches
msg_protos.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_PROTOS_H
27#define MSG_PROTOS_H
28
41#ifndef MSG_HEADER_H
43#endif
44
45SOFIA_BEGIN_DECLS
46
47enum {
48 msg_request_hash = -1,
49 msg_status_hash = -2
50};
51
52
53/* Declare internal prototypes for unknown headers */
54
59enum {
62};
63
65MSG_DLL msg_parse_f msg_unknown_d;
66
68MSG_DLL msg_print_f msg_unknown_e;
69
78MSG_DLL extern msg_hclass_t msg_unknown_class[];
79
91#define MSG_UNKNOWN_INIT() MSG_HDR_INIT(unknown)
92
107#if SU_HAVE_INLINE
112#else
113#define msg_unknown_init(x) \
114 MSG_HEADER_INIT(x, msg_unknown_class, sizeof(msg_unknown_t))
115#endif
116
130#if SU_HAVE_INLINE
132{
133 msg_generic_t const *h = (msg_generic_t *)header;
134 return h && h->g_common->h_class->hc_hash == msg_unknown_hash;
135}
136#else
137int msg_is_unknown(msg_header_t const *header);
138#endif
139
167#if SU_HAVE_INLINE
169#endif
171 msg_unknown_t const *header)
172 __attribute__((__malloc__));
173
174#if SU_HAVE_INLINE
177 msg_unknown_t const *header)
178{
179 return (msg_unknown_t *)
180 msg_header_dup_as(home, msg_unknown_class, (msg_header_t const *)header);
181}
182#endif
183
184
213#if SU_HAVE_INLINE
215#endif
217 msg_unknown_t const *header)
218 __attribute__((__malloc__));
219
220#if SU_HAVE_INLINE
223 msg_unknown_t const *header)
224{
225 return (msg_unknown_t *)
226 msg_header_copy_as(home, msg_unknown_class, (msg_header_t const *)header);
227}
228#endif
229
248#if SU_HAVE_INLINE
250{
252}
253#else
254msg_unknown_t *msg_unknown_make(su_home_t *home, char const *s)
255 __attribute__((__malloc__));
256#endif
257
280#if SU_HAVE_INLINE
282#endif
283msg_unknown_t *msg_unknown_format(su_home_t *home, char const *fmt, ...)
284 __attribute__((__malloc__, __format__ (printf, 2, 3)));
285
286#if SU_HAVE_INLINE
288{
289 msg_header_t *h;
290 va_list ap;
291
292 va_start(ap, fmt);
293 h = msg_header_vformat(home, msg_unknown_class, fmt, ap);
294 va_end(ap);
295
296 return (msg_unknown_t*)h;
297}
298#endif
299
302/* Declare internal prototypes for erroneous headers */
303
308enum {
310 msg_error_hash = -4
312
314MSG_DLL msg_parse_f msg_error_d;
315
317MSG_DLL msg_print_f msg_error_e;
318
327MSG_DLL extern msg_hclass_t msg_error_class[];
328
340#define MSG_ERROR_INIT() MSG_HDR_INIT(error)
341
356#if SU_HAVE_INLINE
361#else
362#define msg_error_init(x) \
363 MSG_HEADER_INIT(x, msg_error_class, sizeof(msg_error_t))
364#endif
365
379#if SU_HAVE_INLINE
381{
382 msg_generic_t const *h = (msg_generic_t *)header;
383 return h && h->g_common->h_class->hc_hash == msg_error_hash;
384}
385#else
386int msg_is_error(msg_header_t const *header);
387#endif
388
416#if SU_HAVE_INLINE
418#endif
420 msg_error_t const *header)
421 __attribute__((__malloc__));
422
423#if SU_HAVE_INLINE
426 msg_error_t const *header)
427{
428 return (msg_error_t *)
429 msg_header_dup_as(home, msg_error_class, (msg_header_t const *)header);
430}
431#endif
432
433
462#if SU_HAVE_INLINE
464#endif
466 msg_error_t const *header)
467 __attribute__((__malloc__));
468
469#if SU_HAVE_INLINE
472 msg_error_t const *header)
473{
474 return (msg_error_t *)
475 msg_header_copy_as(home, msg_error_class, (msg_header_t const *)header);
476}
477#endif
478
497#if SU_HAVE_INLINE
499{
501}
502#else
503msg_error_t *msg_error_make(su_home_t *home, char const *s)
504 __attribute__((__malloc__));
505#endif
506
529#if SU_HAVE_INLINE
531#endif
532msg_error_t *msg_error_format(su_home_t *home, char const *fmt, ...)
533 __attribute__((__malloc__, __format__ (printf, 2, 3)));
534
535#if SU_HAVE_INLINE
536su_inline msg_error_t *msg_error_format(su_home_t *home, char const *fmt, ...)
537{
538 msg_header_t *h;
539 va_list ap;
540
541 va_start(ap, fmt);
542 h = msg_header_vformat(home, msg_error_class, fmt, ap);
543 va_end(ap);
544
545 return (msg_error_t*)h;
546}
547#endif
548
551/* Declare internal prototypes for separator line between headers and body */
552
557enum {
561
563MSG_DLL msg_parse_f msg_separator_d;
564
566MSG_DLL msg_print_f msg_separator_e;
567
576MSG_DLL extern msg_hclass_t msg_separator_class[];
577
589#define MSG_SEPARATOR_INIT() MSG_HDR_INIT(separator)
590
605#if SU_HAVE_INLINE
610#else
611#define msg_separator_init(x) \
612 MSG_HEADER_INIT(x, msg_separator_class, sizeof(msg_separator_t))
613#endif
614
628#if SU_HAVE_INLINE
630{
631 msg_generic_t const *h = (msg_generic_t *)header;
632 return h && h->g_common->h_class->hc_hash == msg_separator_hash;
633}
634#else
635int msg_is_separator(msg_header_t const *header);
636#endif
637
665#if SU_HAVE_INLINE
667#endif
669 msg_separator_t const *header)
670 __attribute__((__malloc__));
671
672#if SU_HAVE_INLINE
675 msg_separator_t const *header)
676{
677 return (msg_separator_t *)
678 msg_header_dup_as(home, msg_separator_class, (msg_header_t const *)header);
679}
680#endif
681
682
711#if SU_HAVE_INLINE
713#endif
715 msg_separator_t const *header)
716 __attribute__((__malloc__));
717
718#if SU_HAVE_INLINE
721 msg_separator_t const *header)
722{
723 return (msg_separator_t *)
725}
726#endif
727
746#if SU_HAVE_INLINE
751#else
752msg_separator_t *msg_separator_make(su_home_t *home, char const *s)
753 __attribute__((__malloc__));
754#endif
755
778#if SU_HAVE_INLINE
780#endif
781msg_separator_t *msg_separator_format(su_home_t *home, char const *fmt, ...)
782 __attribute__((__malloc__, __format__ (printf, 2, 3)));
783
784#if SU_HAVE_INLINE
786{
787 msg_header_t *h;
788 va_list ap;
789
790 va_start(ap, fmt);
791 h = msg_header_vformat(home, msg_separator_class, fmt, ap);
792 va_end(ap);
793
794 return (msg_separator_t*)h;
795}
796#endif
797
800/* Declare internal prototypes for message payload */
801
806enum {
810
812MSG_DLL msg_parse_f msg_payload_d;
813
815MSG_DLL msg_print_f msg_payload_e;
816
825MSG_DLL extern msg_hclass_t msg_payload_class[];
826
838#define MSG_PAYLOAD_INIT() MSG_HDR_INIT(payload)
839
854#if SU_HAVE_INLINE
859#else
860#define msg_payload_init(x) \
861 MSG_HEADER_INIT(x, msg_payload_class, sizeof(msg_payload_t))
862#endif
863
877#if SU_HAVE_INLINE
879{
880 msg_generic_t const *h = (msg_generic_t *)header;
881 return h && h->g_common->h_class->hc_hash == msg_payload_hash;
882}
883#else
884int msg_is_payload(msg_header_t const *header);
885#endif
886
914#if SU_HAVE_INLINE
916#endif
918 msg_payload_t const *header)
919 __attribute__((__malloc__));
920
921#if SU_HAVE_INLINE
924 msg_payload_t const *header)
925{
926 return (msg_payload_t *)
927 msg_header_dup_as(home, msg_payload_class, (msg_header_t const *)header);
928}
929#endif
930
931
960#if SU_HAVE_INLINE
962#endif
964 msg_payload_t const *header)
965 __attribute__((__malloc__));
966
967#if SU_HAVE_INLINE
970 msg_payload_t const *header)
971{
972 return (msg_payload_t *)
973 msg_header_copy_as(home, msg_payload_class, (msg_header_t const *)header);
974}
975#endif
976
995#if SU_HAVE_INLINE
997{
999}
1000#else
1001msg_payload_t *msg_payload_make(su_home_t *home, char const *s)
1002 __attribute__((__malloc__));
1003#endif
1004
1027#if SU_HAVE_INLINE
1029#endif
1030msg_payload_t *msg_payload_format(su_home_t *home, char const *fmt, ...)
1031 __attribute__((__malloc__, __format__ (printf, 2, 3)));
1032
1033#if SU_HAVE_INLINE
1035{
1036 msg_header_t *h;
1037 va_list ap;
1038
1039 va_start(ap, fmt);
1040 h = msg_header_vformat(home, msg_payload_class, fmt, ap);
1041 va_end(ap);
1042
1043 return (msg_payload_t*)h;
1044}
1045#endif
1046
1050SOFIA_END_DECLS
1051
1052#endif
msg_print_f msg_error_e
Print a erroneous headers.
Definition msg_protos.h:317
msg_error_t * msg_error_copy(su_home_t *home, msg_error_t const *header))
Copy a msg_error_t header structure.
Definition msg_protos.h:471
msg_parse_f msg_error_d
Parse a erroneous headers.
Definition msg_protos.h:314
int msg_is_error(msg_header_t const *header)
Test if header object is instance of msg_error_t.
Definition msg_protos.h:380
msg_hclass_t msg_error_class[]
Header class for erroneous headers.
Definition msg_basic.c:80
msg_error_t * msg_error_make(su_home_t *home, char const *s)
Make a header structure msg_error_t.
Definition msg_protos.h:498
msg_error_t * msg_error_init(msg_error_t x[1])
Initialize a structure msg_error_t.
Definition msg_protos.h:357
msg_error_t * msg_error_format(su_home_t *home, char const *fmt,...)))
Make a erroneous headers from formatting result.
Definition msg_protos.h:536
msg_error_t * msg_error_dup(su_home_t *home, msg_error_t const *header))
Duplicate (deep copy) msg_error_t.
Definition msg_protos.h:425
@ msg_error_hash
Hash of erroneous headers.
Definition msg_protos.h:310
msg_print_f msg_payload_e
Print a message payload.
Definition msg_protos.h:815
msg_payload_t * msg_payload_format(su_home_t *home, char const *fmt,...)))
Make a message payload from formatting result.
Definition msg_protos.h:1034
msg_parse_f msg_payload_d
Parse a message payload.
Definition msg_protos.h:812
msg_payload_t * msg_payload_dup(su_home_t *home, msg_payload_t const *header))
Duplicate (deep copy) msg_payload_t.
Definition msg_protos.h:923
msg_payload_t * msg_payload_init(msg_payload_t x[1])
Initialize a structure msg_payload_t.
Definition msg_protos.h:855
msg_payload_t * msg_payload_copy(su_home_t *home, msg_payload_t const *header))
Copy a msg_payload_t header structure.
Definition msg_protos.h:969
msg_hclass_t msg_payload_class[]
Header class for message payload.
Definition msg_basic.c:207
msg_payload_t * msg_payload_make(su_home_t *home, char const *s)
Make a header structure msg_payload_t.
Definition msg_protos.h:996
int msg_is_payload(msg_header_t const *header)
Test if header object is instance of msg_payload_t.
Definition msg_protos.h:878
@ msg_payload_hash
Hash of message payload.
Definition msg_protos.h:808
msg_hclass_t msg_separator_class[]
Header class for separator line between headers and body.
Definition msg_basic.c:320
msg_print_f msg_separator_e
Print a separator line between headers and body.
Definition msg_protos.h:566
msg_separator_t * msg_separator_init(msg_separator_t x[1])
Initialize a structure msg_separator_t.
Definition msg_protos.h:606
int msg_is_separator(msg_header_t const *header)
Test if header object is instance of msg_separator_t.
Definition msg_protos.h:629
msg_parse_f msg_separator_d
Parse a separator line between headers and body.
Definition msg_protos.h:563
msg_separator_t * msg_separator_copy(su_home_t *home, msg_separator_t const *header))
Copy a msg_separator_t header structure.
Definition msg_protos.h:720
msg_separator_t * msg_separator_format(su_home_t *home, char const *fmt,...)))
Make a separator line between headers and body from formatting result.
Definition msg_protos.h:785
msg_separator_t * msg_separator_dup(su_home_t *home, msg_separator_t const *header))
Duplicate (deep copy) msg_separator_t.
Definition msg_protos.h:674
msg_separator_t * msg_separator_make(su_home_t *home, char const *s)
Make a header structure msg_separator_t.
Definition msg_protos.h:747
@ msg_separator_hash
Hash of separator line between headers and body.
Definition msg_protos.h:559
msg_unknown_t * msg_unknown_make(su_home_t *home, char const *s)
Make a header structure msg_unknown_t.
Definition msg_protos.h:249
msg_unknown_t * msg_unknown_copy(su_home_t *home, msg_unknown_t const *header))
Copy a msg_unknown_t header structure.
Definition msg_protos.h:222
msg_print_f msg_unknown_e
Print a unknown headers.
Definition msg_protos.h:68
msg_unknown_t * msg_unknown_init(msg_unknown_t x[1])
Initialize a structure msg_unknown_t.
Definition msg_protos.h:108
int msg_is_unknown(msg_header_t const *header)
Test if header object is instance of msg_unknown_t.
Definition msg_protos.h:131
msg_unknown_t * msg_unknown_dup(su_home_t *home, msg_unknown_t const *header))
Duplicate (deep copy) msg_unknown_t.
Definition msg_protos.h:176
msg_hclass_t msg_unknown_class[]
Header class for unknown headers.
Definition msg_basic.c:127
msg_unknown_t * msg_unknown_format(su_home_t *home, char const *fmt,...)))
Make a unknown headers from formatting result.
Definition msg_protos.h:287
msg_parse_f msg_unknown_d
Parse a unknown headers.
Definition msg_protos.h:65
@ msg_unknown_hash
Hash of unknown headers.
Definition msg_protos.h:61
Message headers.
msg_header_t * msg_header_make(su_home_t *home, msg_hclass_t *hc, char const *s))
Make a header from a value string.
Definition msg_header_make.c:64
msg_header_t * msg_header_vformat(su_home_t *home, msg_hclass_t *hc, char const *fmt, va_list ap))
Make a MSG header with formatting provided.
Definition msg_header_make.c:105
msg_header_t * msg_header_copy_as(su_home_t *home, msg_hclass_t *hc, msg_header_t const *o))
Copy a list of header objects.
Definition msg_header_copy.c:148
msg_header_t * msg_header_dup_as(su_home_t *home, msg_hclass_t *hc, msg_header_t const *o))
Duplicate a header as class hc.
Definition msg_header_copy.c:259
#define MSG_HEADER_INIT(h, msg_class, size)
Initialize a header structure.
Definition msg_header.h:298
struct msg_hclass_s const msg_hclass_t
Header class.
Definition msg_types.h:48
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition msg_types.h:87
msg_hclass_t * h_class
Header class.
Definition msg_types.h:114
Erroneus header.
Definition msg_types.h:199
Generic header.
Definition msg_types.h:151
msg_common_t g_common[1]
Common fragment info.
Definition msg_types.h:152
Message payload.
Definition msg_types.h:214
Separator.
Definition msg_types.h:207
Unknown header.
Definition msg_types.h:191
SU_HOME_T su_home_t
#define su_inline

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