su  1.12.11devel
su_tag_class.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 SU_TAG_CLASS_H
26 
27 #define SU_TAG_CLASS_H
28 
38 #ifndef SU_TAG_H
39 #include <sofia-sip/su_tag.h>
40 #endif
41 
42 SOFIA_BEGIN_DECLS
43 
44 /* Macros for defining tag classes */
45 
46 #ifndef TAG_NAMESPACE
47 
48 #define TAG_NAMESPACE ""
49 #endif
50 
51 #define TAG_TYPEDEF(t, type) \
52  {{ TAG_NAMESPACE, #t, type ## _tag_class, 0 }}
53 
54 #define INTTAG_TYPEDEF(t) TAG_TYPEDEF(t, int)
55 #define UINTTAG_TYPEDEF(t) TAG_TYPEDEF(t, uint)
56 #define USIZETAG_TYPEDEF(t) TAG_TYPEDEF(t, usize)
57 #define SIZETAG_TYPEDEF(t) TAG_TYPEDEF(t, size)
58 #define BOOLTAG_TYPEDEF(t) TAG_TYPEDEF(t, bool)
59 #define PTRTAG_TYPEDEF(t) TAG_TYPEDEF(t, ptr)
60 #define SOCKETTAG_TYPEDEF(t) TAG_TYPEDEF(t, socket)
61 #define CSTRTAG_TYPEDEF(t) TAG_TYPEDEF(t, cstr)
62 #define STRTAG_TYPEDEF(t) TAG_TYPEDEF(t, str)
63 #define NSTAG_TYPEDEF(t) TAG_TYPEDEF(t, ns)
64 
65 struct tag_class_s {
66  int tc_size;
67  tagi_t const *(*tc_next)(tagi_t const *t);
68  size_t (*tc_len)(tagi_t const *t);
69  tagi_t *(*tc_move)(tagi_t *dst, tagi_t const *src);
70  size_t (*tc_xtra)(tagi_t const *t, size_t offset);
71  tagi_t *(*tc_dup)(tagi_t *dst, tagi_t const *src, void **b);
72  tagi_t *(*tc_free)(tagi_t *t);
73  tagi_t const *(*tc_find)(tag_type_t t, tagi_t const lst[]);
74  int (*tc_snprintf)(tagi_t const *t, char b[], size_t size);
75  tagi_t *(*tc_filter)(tagi_t *dst, tagi_t const f[], tagi_t const *src,
76  void **bb);
77  int (*tc_ref_set)(tag_type_t tt, void *ref, tagi_t const value[]);
78  int (*tc_scan)(tag_type_t tt, su_home_t *home,
79  char const *str,
80  tag_value_t *return_value);
81 };
82 
83 SOFIAPUBVAR tag_class_t end_tag_class[];
84 SOFIAPUBVAR tag_class_t int_tag_class[];
85 SOFIAPUBVAR tag_class_t uint_tag_class[];
88 SOFIAPUBVAR tag_class_t bool_tag_class[];
89 SOFIAPUBVAR tag_class_t ptr_tag_class[];
90 SOFIAPUBVAR tag_class_t socket_tag_class[];
92 SOFIAPUBVAR tag_class_t str_tag_class[];
94 
95 #define REFTAG_TYPEDEF(tag) \
96  {{ TAG_NAMESPACE, #tag "_ref", ref_tag_class, (tag_value_t)tag }}
97 
98 SOFIAPUBVAR tag_class_t ref_tag_class[];
99 
101  tagi_t const *, void **);
102 SOFIAPUBFUN tagi_t *t_null_filter(tagi_t *dst, tagi_t const filter[],
103  tagi_t const *src, void **bb);
104 SOFIAPUBFUN tagi_t *t_end_filter(tagi_t *, tagi_t const [],
105  tagi_t const *, void **);
106 
107 SOFIAPUBFUN int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
108 SOFIAPUBFUN int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
109 SOFIAPUBFUN int t_ptr_scan(tag_type_t, su_home_t *, char const *,
110  tag_value_t *return_value);
111 
112 SOFIAPUBFUN int t_bool_snprintf(tagi_t const *t, char b[], size_t size);
113 SOFIAPUBFUN int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
114 SOFIAPUBFUN int t_bool_scan(tag_type_t, su_home_t *, char const *,
115  tag_value_t *return_value);
116 
117 SOFIAPUBFUN int t_int_snprintf(tagi_t const *t, char b[], size_t size);
118 SOFIAPUBFUN int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
119 SOFIAPUBFUN int t_int_scan(tag_type_t, su_home_t *, char const *,
120  tag_value_t *return_value);
121 
122 SOFIAPUBFUN int t_uint_snprintf(tagi_t const *t, char b[], size_t size);
123 SOFIAPUBFUN int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
124 SOFIAPUBFUN int t_uint_scan(tag_type_t, su_home_t *, char const *,
125  tag_value_t *return_value);
126 
127 SOFIAPUBFUN int t_socket_snprintf(tagi_t const *t, char b[], size_t size);
128 SOFIAPUBFUN int t_socket_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
129 
130 SOFIAPUBFUN tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
131 SOFIAPUBFUN size_t t_str_xtra(tagi_t const *t, size_t offset);
132 SOFIAPUBFUN int t_str_snprintf(tagi_t const *t, char b[], size_t size);
133 SOFIAPUBFUN int t_str_scan(tag_type_t, su_home_t *, char const *,
134  tag_value_t *return_value);
135 
136 SOFIA_END_DECLS
137 
138 #endif /* !defined(SU_TAG_CLASS_H) */
su_home_t
SU_HOME_T su_home_t
Memory home type.
Definition: su_alloc.h:50
size_tag_class
tag_class_t size_tag_class[]
Tag class for tags with size_t value.
Definition: su_taglist.c:1316
tag_type_t
struct tag_type_s const * tag_type_t
Tag item type.
Definition: su_tag.h:55
tag_class_s
Virtual function table for tags.
Definition: su_tag_class.h:65
ns_tag_class
tag_class_t ns_tag_class[]
Namespace filtering class.
Definition: su_taglist.c:1161
tag_value_t
intptr_t tag_value_t
Tag item value.
Definition: su_tag.h:57
tagi_t
Tag item.
Definition: su_tag.h:63
cstr_tag_class
tag_class_t cstr_tag_class[]
Tag class for constant strings.
Definition: su_taglist.c:1588
t_filter
tagi_t * t_filter(tagi_t *, tagi_t const [], tagi_t const *, void **)
Filter an element in tag list.
Definition: su_taglist.c:466
SOFIAPUBVAR
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition: su_config.h:68
SOFIAPUBFUN
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition: su_config.h:66
su_tag.h
tag_class_t
struct tag_class_s const tag_class_t
Tag type class.
Definition: su_tag.h:69
usize_tag_class
tag_class_t usize_tag_class[]
Tag class for tags with usize_t value.
Definition: su_taglist.c:1364
tag_class_s::tc_size
int tc_size
Size of the tag_class_t structure.
Definition: su_tag_class.h:66

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