Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00041 #ifndef PARSE_PARAM_H
00042 #define PARSE_PARAM_H
00043
00044 #include <stdio.h>
00045
00046 #include "../str.h"
00047
00051 typedef enum ptype {
00052 P_OTHER = 0,
00053 P_Q,
00054 P_EXPIRES,
00055 P_METHODS,
00056 P_RECEIVED,
00057 P_TRANSPORT,
00058 P_LR,
00059 P_R2,
00060 P_MADDR,
00061 P_TTL,
00062 P_DSTIP,
00063 P_DSTPORT,
00064 P_INSTANCE,
00065 P_REG_ID,
00066 P_FTAG,
00067 P_CALL_ID,
00068 P_FROM_TAG,
00069 P_TO_TAG,
00070 P_ISD,
00071 P_SLA,
00072 P_MA
00073 } ptype_t;
00074
00075
00079 typedef enum pclass {
00080 CLASS_ANY = 0,
00081 CLASS_CONTACT,
00082 CLASS_URI,
00083 CLASS_EVENT_DIALOG
00084 } pclass_t;
00085
00086
00090 typedef struct param {
00091 ptype_t type;
00092 str name;
00093 str body;
00094 int len;
00095 struct param* next;
00096 } param_t;
00097
00098
00102 struct contact_hooks {
00103 struct param* expires;
00104 struct param* q;
00105 struct param* methods;
00106 struct param* received;
00107 struct param* instance;
00108 struct param* reg_id;
00109 };
00110
00111
00115 struct uri_hooks {
00116 struct param* transport;
00117 struct param* lr;
00118 struct param* r2;
00119 struct param* maddr;
00120 struct param* ttl;
00121 struct param* dstip;
00122 struct param* dstport;
00123 struct param* ftag;
00124 };
00125
00126
00127 struct event_dialog_hooks {
00128 struct param* call_id;
00129 struct param* from_tag;
00130 struct param* to_tag;
00131 struct param* include_session_description;
00132 struct param* sla;
00133 struct param* ma;
00134 };
00135
00139 typedef union param_hooks {
00140 struct contact_hooks contact;
00141 struct uri_hooks uri;
00142 struct event_dialog_hooks event_dialog;
00143 } param_hooks_t;
00144
00153 inline int parse_param(str *_s, pclass_t _c, param_hooks_t *_h, param_t *t);
00154
00155
00165 int parse_params(str* _s, pclass_t _c, param_hooks_t* _h, param_t** _p);
00166
00167
00171 void free_params(param_t* _p);
00172
00173
00177 void shm_free_params(param_t* _p);
00178
00179
00183 void print_params(FILE* _o, param_t* _p);
00184
00185
00189 int duplicate_params(param_t** _n, param_t* _p);
00190
00191
00195 int shm_duplicate_params(param_t** _n, param_t* _p);
00196
00197
00198 #endif