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

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