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 }}
00053 
00054 #define INTTAG_TYPEDEF(t)      TAG_TYPEDEF(t, int)
00055 #define UINTTAG_TYPEDEF(t)     TAG_TYPEDEF(t, uint)
00056 #define BOOLTAG_TYPEDEF(t)     TAG_TYPEDEF(t, bool)
00057 #define PTRTAG_TYPEDEF(t)      TAG_TYPEDEF(t, ptr)
00058 #define CSTRTAG_TYPEDEF(t)     TAG_TYPEDEF(t, cstr)
00059 #define STRTAG_TYPEDEF(t)      TAG_TYPEDEF(t, str)
00060 #define NSTAG_TYPEDEF(t)       TAG_TYPEDEF(t, ns)
00061 
00062 struct tag_class_s {
00063   int             tc_size;
00064   tagi_t const *(*tc_next)(tagi_t const *t);
00065   size_t        (*tc_len)(tagi_t const *t);
00066   tagi_t       *(*tc_move)(tagi_t *dst, tagi_t const *src);
00067   size_t        (*tc_xtra)(tagi_t const *t, size_t offset);
00068   tagi_t       *(*tc_dup)(tagi_t *dst, tagi_t const *src, void **b);
00069   tagi_t       *(*tc_free)(tagi_t *t);
00070   tagi_t const *(*tc_find)(tag_type_t t, tagi_t const lst[]);
00071   int           (*tc_snprintf)(tagi_t const *t, char b[], size_t size);
00072   tagi_t       *(*tc_filter)(tagi_t *dst, tagi_t const f[], tagi_t const *src,
00073                              void **bb);
00074   int           (*tc_ref_set)(tag_type_t tt, void *ref, tagi_t const value[]);
00075   int           (*tc_scan)(tag_type_t tt, su_home_t *home,
00076                            char const *str,
00077                            tag_value_t *return_value);
00078 };
00079 
00080 SOFIAPUBVAR tag_class_t end_tag_class[];
00081 SOFIAPUBVAR tag_class_t int_tag_class[];
00082 SOFIAPUBVAR tag_class_t uint_tag_class[];
00083 SOFIAPUBVAR tag_class_t bool_tag_class[];
00084 SOFIAPUBVAR tag_class_t ptr_tag_class[];
00085 SOFIAPUBVAR tag_class_t cstr_tag_class[];
00086 SOFIAPUBVAR tag_class_t str_tag_class[];
00087 SOFIAPUBVAR tag_class_t ns_tag_class[];
00088 
00089 #define REFTAG_TYPEDEF(tag) \
00090   {{ TAG_NAMESPACE, #tag "_ref", ref_tag_class, (tag_value_t)tag }}
00091 
00092 SOFIAPUBVAR tag_class_t ref_tag_class[];
00093 
00094 SOFIAPUBFUN int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
00095 SOFIAPUBFUN int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00096 SOFIAPUBFUN int t_ptr_scan(tag_type_t, su_home_t *, char const *,
00097                            tag_value_t *return_value);
00098 
00099 SOFIAPUBFUN int t_bool_snprintf(tagi_t const *t, char b[], size_t size);
00100 SOFIAPUBFUN int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00101 SOFIAPUBFUN int t_bool_scan(tag_type_t, su_home_t *, char const *,
00102                             tag_value_t *return_value);
00103 
00104 SOFIAPUBFUN int t_int_snprintf(tagi_t const *t, char b[], size_t size);
00105 SOFIAPUBFUN int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00106 SOFIAPUBFUN int t_int_scan(tag_type_t, su_home_t *, char const *,
00107                            tag_value_t *return_value);
00108 
00109 SOFIAPUBFUN int t_uint_snprintf(tagi_t const *t, char b[], size_t size);
00110 SOFIAPUBFUN int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
00111 SOFIAPUBFUN int t_uint_scan(tag_type_t, su_home_t *, char const *,
00112                             tag_value_t *return_value);
00113 
00114 SOFIAPUBFUN tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
00115 SOFIAPUBFUN size_t t_str_xtra(tagi_t const *t, size_t offset);
00116 SOFIAPUBFUN int t_str_snprintf(tagi_t const *t, char b[], size_t size);
00117 SOFIAPUBFUN int t_str_scan(tag_type_t, su_home_t *, char const *,
00118                            tag_value_t *return_value);
00119 
00120 SOFIA_END_DECLS
00121 
00122 #endif /* !defined(SU_TAG_CLASS_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.