sofia-sip/su_tag_class.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 SU_TAG_CLASS_H
00026 
00027 #define SU_TAG_CLASS_H 
00028 
00038 #ifndef SU_TAG_H
00039 #include <sofia-sip/su_tag.h>
00040 #endif
00041 
00042 SOFIA_BEGIN_DECLS
00043 
00044 /* Macros for defining tag classes */
00045 
00046 #ifndef TAG_NAMESPACE
00047 
00048 #define TAG_NAMESPACE ""
00049 #endif
00050 
00051 #define TAG_TYPEDEF(t, type) \
00052   {{ TAG_NAMESPACE, #t, type ## _tag_class, 0 }}
00053 
00054 #define INTTAG_TYPEDEF(t)      TAG_TYPEDEF(t, int)
00055 #define UINTTAG_TYPEDEF(t)     TAG_TYPEDEF(t, uint)
00056 #define USIZETAG_TYPEDEF(t)    TAG_TYPEDEF(t, usize)
00057 #define SIZETAG_TYPEDEF(t)     TAG_TYPEDEF(t, size)
00058 #define BOOLTAG_TYPEDEF(t)     TAG_TYPEDEF(t, bool)
00059 #define PTRTAG_TYPEDEF(t)      TAG_TYPEDEF(t, ptr)
00060 #define SOCKETTAG_TYPEDEF(t)   TAG_TYPEDEF(t, socket)
00061 #define CSTRTAG_TYPEDEF(t)     TAG_TYPEDEF(t, cstr)
00062 #define STRTAG_TYPEDEF(t)      TAG_TYPEDEF(t, str)
00063 #define NSTAG_TYPEDEF(t)       TAG_TYPEDEF(t, ns)
00064 
00065 struct tag_class_s {
00066   int             tc_size;      
00067   tagi_t const *(*tc_next)(tagi_t const *t);
00068   size_t        (*tc_len)(tagi_t const *t);
00069   tagi_t       *(*tc_move)(tagi_t *dst, tagi_t const *src);
00070   size_t        (*tc_xtra)(tagi_t const *t, size_t offset);
00071   tagi_t       *(*tc_dup)(tagi_t *dst, tagi_t const *src, void **b);
00072   tagi_t       *(*tc_free)(tagi_t *t);
00073   tagi_t const *(*tc_find)(tag_type_t t, tagi_t const lst[]);
00074   int           (*tc_snprintf)(tagi_t const *t, char b[], size_t size);
00075   tagi_t       *(*tc_filter)(tagi_t *dst, tagi_t const f[], tagi_t const *src,
00076                              void **bb);
00077   int           (*tc_ref_set)(tag_type_t tt, void *ref, tagi_t const value[]);
00078   int           (*tc_scan)(tag_type_t tt, su_home_t *home,
00079                            char const *str,
00080                            tag_value_t *return_value);
00081 };
00082 
00083 SOFIAPUBVAR tag_class_t end_tag_class[];
00084 SOFIAPUBVAR tag_class_t int_tag_class[];
00085 SOFIAPUBVAR tag_class_t uint_tag_class[];
00086 SOFIAPUBVAR tag_class_t usize_tag_class[];
00087 SOFIAPUBVAR tag_class_t size_tag_class[];
00088 SOFIAPUBVAR tag_class_t bool_tag_class[];
00089 SOFIAPUBVAR tag_class_t ptr_tag_class[];
00090 SOFIAPUBVAR tag_class_t socket_tag_class[];
00091 SOFIAPUBVAR tag_class_t cstr_tag_class[];
00092 SOFIAPUBVAR tag_class_t str_tag_class[];
00093 SOFIAPUBVAR tag_class_t ns_tag_class[];
00094 
00095 #define REFTAG_TYPEDEF(tag) \
00096   {{ TAG_NAMESPACE, #tag "_ref", ref_tag_class, (tag_value_t)tag }}
00097 
00098 SOFIAPUBVAR tag_class_t ref_tag_class[];
00099 
00100 SOFIAPUBFUN int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
00101 SOFIAPUBFUN int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00102 SOFIAPUBFUN int t_ptr_scan(tag_type_t, su_home_t *, char const *,
00103                            tag_value_t *return_value);
00104 
00105 SOFIAPUBFUN int t_bool_snprintf(tagi_t const *t, char b[], size_t size);
00106 SOFIAPUBFUN int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00107 SOFIAPUBFUN int t_bool_scan(tag_type_t, su_home_t *, char const *,
00108                             tag_value_t *return_value);
00109 
00110 SOFIAPUBFUN int t_int_snprintf(tagi_t const *t, char b[], size_t size);
00111 SOFIAPUBFUN int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00112 SOFIAPUBFUN int t_int_scan(tag_type_t, su_home_t *, char const *,
00113                            tag_value_t *return_value);
00114 
00115 SOFIAPUBFUN int t_uint_snprintf(tagi_t const *t, char b[], size_t size);
00116 SOFIAPUBFUN int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00117 SOFIAPUBFUN int t_uint_scan(tag_type_t, su_home_t *, char const *,
00118                             tag_value_t *return_value);
00119 
00120 SOFIAPUBFUN tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
00121 SOFIAPUBFUN size_t t_str_xtra(tagi_t const *t, size_t offset);
00122 SOFIAPUBFUN int t_str_snprintf(tagi_t const *t, char b[], size_t size);
00123 SOFIAPUBFUN int t_str_scan(tag_type_t, su_home_t *, char const *,
00124                            tag_value_t *return_value);
00125 
00126 SOFIA_END_DECLS
00127 
00128 #endif /* !defined(SU_TAG_CLASS_H) */

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