sofia-sip/sip_parser.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 SIP_PARSER_H
00026 
00027 #define SIP_PARSER_H 
00028 
00029 
00043 #ifndef SU_ALLOC_H
00044 #include <sofia-sip/su_alloc.h>
00045 #endif
00046 
00047 #ifndef MSG_H
00048 #include <sofia-sip/msg.h>
00049 #endif
00050 
00051 #ifndef MSG_PARSER_H
00052 #include <sofia-sip/msg_parser.h>
00053 #endif
00054 
00055 #ifndef SIP_H
00056 #include <sofia-sip/sip.h>
00057 #endif
00058 
00059 #ifndef SIP_HEADER_H
00060 #include <sofia-sip/sip_header.h>
00061 #endif
00062 
00063 SOFIA_BEGIN_DECLS
00064 
00065 /* ---------------------------------------------------------------------------
00066  * 1) Macros for defining boilerplate functions and structures for each header
00067  */
00068 
00069 #define SIP_HDR_TEST(x)    ((x)->sh_class)
00070 
00072 #define SIP_HEADER_CLASS(c, l, s, params, kind, dup)            \
00073   MSG_HEADER_CLASS(sip_, c, l, s, params, kind, sip_ ## dup, sip_ ## dup)
00074 
00076 #define SIP_HEADER_CLASS_C(c, l, s, params, kind, dup)  \
00077   MSG_HEADER_CLASS_C(sip_, c, l, s, params, kind, sip_ ## dup, sip_ ## dup)
00078 
00080 #define SIP_HEADER_CLASS_G(c, l, s, kind) \
00081   MSG_HEADER_CLASS(sip_, c, l, s, g_common, kind, msg_generic, sip_null)
00082 
00084 #define SIP_HEADER_CLASS_LIST(c, l, s, kind) \
00085   MSG_HEADER_CLASS(sip_, c, l, s, k_items, kind, msg_list, sip_null)
00086 
00088 #define SIP_HEADER_CLASS_AUTH(c, l, kind) \
00089   MSG_HEADER_CLASS(sip_, c, l, "", au_params, kind, msg_auth, sip_null)
00090 
00091 #define sip_null_update NULL
00092 #define sip_any_update NULL
00093 
00094 /* ---------------------------------------------------------------------------
00095  * 2) Prototypes for internal decoding/encoding functions
00096  */
00097 
00098 /* Version string */
00099 SOFIAPUBFUN int sip_version_d(char **ss, char const **ver);
00100 SOFIAPUBFUN isize_t sip_version_xtra(char const *version);
00101 SOFIAPUBFUN void sip_version_dup(char **pp, char const **dd, char const *s);
00102 
00103 /* Transport identifiers */
00104 #define SIP_TRANSPORT_LEN(s) SIP_STRING_SIZE((s))
00105 SOFIAPUBFUN issize_t sip_transport_d(char **ss, char const **ttransport);
00106 SOFIAPUBFUN isize_t sip_transport_xtra(char const *transport);
00107 SOFIAPUBFUN void sip_transport_dup(char **pp, char const **dd, char const *s);
00108 
00109 /* Method */
00110 SOFIAPUBFUN sip_method_t sip_method_d(char **ss, char const **nname);
00111 
00112 /* Call-ID */
00113 SOFIAPUBFUN char *sip_word_at_word_d(char **ss);
00114 
00116 SOFIAPUBFUN issize_t sip_extract_body(msg_t *, sip_t *, char b[], isize_t bsiz, int eos);
00117 
00118 SOFIAPUBFUN issize_t sip_any_route_d(su_home_t *, sip_header_t *, char *s, isize_t slen);
00119 SOFIAPUBFUN issize_t sip_any_route_e(char [], isize_t, sip_header_t const *, int flags);
00120 SOFIAPUBFUN isize_t sip_any_route_dup_xtra(sip_header_t const *h, isize_t offset);
00121 SOFIAPUBFUN char *sip_any_route_dup_one(sip_header_t *dst,
00122                                         sip_header_t const *src,
00123                                         char *b, isize_t xtra);
00124 #define sip_any_route_update NULL
00125 
00126 SOFIAPUBFUN issize_t sip_name_addr_d(su_home_t *home,
00127                                      char **inout_s,
00128                                      char const **return_display,
00129                                      url_t *out_url,
00130                                      msg_param_t const **return_params,
00131                                      char const **return_comment);
00132 
00133 SOFIAPUBFUN issize_t sip_name_addr_e(char b[], isize_t bsiz, 
00134                                      int flags, 
00135                                      char const *display, 
00136                                      int always_ltgt, url_t const url[],
00137                                      msg_param_t const params[], 
00138                                      char const *comment);
00139 
00140 /* ---------------------------------------------------------------------------
00141  * 3) Compatibility macros and functions
00142  */
00143 
00144 #define sip_generic_d           msg_generic_d
00145 #define sip_generic_e           msg_generic_e
00146 
00147 #define sip_numeric_d           msg_numeric_d
00148 #define sip_numeric_e           msg_numeric_e
00149 
00150 #define sip_any_copy_xtra       msg_default_copy_xtra
00151 #define sip_any_copy_one        msg_default_copy_one
00152 #define sip_any_dup_xtra        msg_default_dup_xtra
00153 #define sip_any_dup_one         msg_default_dup_one
00154 
00155 #define sip_generic_dup_xtra    msg_generic_dup_xtra
00156 #define sip_generic_dup_one     msg_generic_dup_one
00157 
00158 
00159 #define sip_auth_d              msg_auth_d         
00160 #define sip_auth_e              msg_auth_e
00161 
00162 #define sip_header_dup_as       msg_header_dup_as
00163 #define sip_header_alloc        msg_header_alloc
00164 #define sip_header_copy_as      msg_header_copy_as
00165 
00166 #define SIP_ALIGN               MSG_ALIGN
00167 #define SIP_STRUCT_SIZE_ALIGN   MSG_STRUCT_SIZE_ALIGN
00168 #define SIP_STRUCT_ALIGN        MSG_STRUCT_ALIGN
00169 
00170 #define sip_comment_d           msg_comment_d
00171 #define sip_quoted_d(ss, qq)    msg_quoted_d(ss, qq)
00172 
00173 #define SIP_CHAR_E              MSG_CHAR_E
00174 #define SIP_STRING_LEN          MSG_STRING_LEN
00175 #define SIP_STRING_E            MSG_STRING_E
00176 #define SIP_STRING_DUP          MSG_STRING_DUP
00177 #define SIP_STRING_SIZE         MSG_STRING_SIZE
00178 #define SIP_NAME_E              MSG_NAME_E
00179 
00180 /* Parameters */
00181 #define SIP_PARAM_MATCH         MSG_PARAM_MATCH
00182 #define SIP_PARAM_MATCH_P       MSG_PARAM_MATCH_P
00183 
00184 /* Parameter lists */
00185 #define SIP_N_PARAMS            MSG_N_PARAMS
00186 #define sip_params_d            msg_params_d
00187 #define sip_params_dup          msg_params_dup
00188 #define SIP_PARAMS_NUM          MSG_PARAMS_NUM
00189 #define SIP_PARAMS_E            MSG_PARAMS_E
00190 #define SIP_PARAMS_SIZE         MSG_PARAMS_SIZE
00191 #define sip_params_count        msg_params_count
00192 #define sip_params_copy_xtra    msg_params_copy_xtra
00193 #define sip_params_copy         msg_params_copy
00194 
00195 SOFIAPUBFUN int sip_generic_xtra(sip_generic_t const *g);
00196 
00197 SOFIAPUBFUN sip_generic_t *sip_generic_dup(su_home_t *home, 
00198                                            msg_hclass_t *hc, 
00199                                            sip_generic_t const *u);
00200 
00201 SOFIAPUBFUN sip_generic_t *sip_generic_copy(su_home_t *home,
00202                                             msg_hclass_t *hc, 
00203                                             sip_generic_t const *o);
00204 
00205 SOFIA_END_DECLS
00206 
00207 #endif

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