-
Notifications
You must be signed in to change notification settings - Fork 908
/
cxdx_avp.h
291 lines (259 loc) · 10.2 KB
/
cxdx_avp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/*
* $Id$
*
* Copyright (C) 2012 Smile Communications, jason.penton@smilecoms.com
* Copyright (C) 2012 Smile Communications, richard.good@smilecoms.com
*
* The initial version of this code was written by Dragos Vingarzan
* (dragos(dot)vingarzan(at)fokus(dot)fraunhofer(dot)de and the
* Fruanhofer Institute. It was and still is maintained in a separate
* branch of the original SER. We are therefore migrating it to
* Kamailio/SR and look forward to maintaining it from here on out.
* 2011/2012 Smile Communications, Pty. Ltd.
* ported/maintained/improved by
* Jason Penton (jason(dot)penton(at)smilecoms.com and
* Richard Good (richard(dot)good(at)smilecoms.com) as part of an
* effort to add full IMS support to Kamailio/SR using a new and
* improved architecture
*
* NB: Alot of this code was originally part of OpenIMSCore,
* FhG Fokus.
* Copyright (C) 2004-2006 FhG Fokus
* Thanks for great work! This is an effort to
* break apart the various CSCF functions into logically separate
* components. We hope this will drive wider use. We also feel
* that in this way the architecture is more complete and thereby easier
* to manage in the Kamailio/SR environment
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* Kamailio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef IS_CSCF_CXDX_AVP_H
#define IS_CSCF_CXDX_AVP_H
extern struct cdp_binds cdpb; /**< Structure with pointers to cdp funcs */
extern struct tm_binds tmb;
struct AAAMessage;
struct AAA_AVP;
struct sip_msg;
int cxdx_add_call_id(AAAMessage *msg, str data);
/**
* Creates and adds a Destination-Realm AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_destination_realm(AAAMessage *msg, str data);
/**
* Creates and adds a Vendor-Specifig-Application-ID AVP.
* @param msg - the Diameter message to add to.
* @param vendor_id - the value of the vendor_id,
* @param auth_id - the authorization application id
* @param acct_id - the accounting application id
* @returns 1 on success or 0 on error
*/
int cxdx_add_vendor_specific_appid(AAAMessage *msg, unsigned int vendor_id,
unsigned int auth_id, unsigned int acct_id);
/**
* Creates and adds an Auth-Session-State AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_auth_session_state(AAAMessage *msg, unsigned int data);
/**
* Creates and adds a User-Name AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_user_name(AAAMessage *msg, str data);
/**
* Creates and adds a Public Identity AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_public_identity(AAAMessage *msg, str data);
/**
* Creates and adds a Visited-Network-ID AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_visited_network_id(AAAMessage *msg, str data);
/**
* Creates and adds a UAR-Flags AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_UAR_flags(AAAMessage *msg, unsigned int sos_reg);
/**
* Creates and adds an Authorization-Type AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_authorization_type(AAAMessage *msg, unsigned int data);
/**
* Returns the Result-Code AVP from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
int cxdx_get_result_code(AAAMessage *msg, int *data);
/**
* Returns the Experimental-Result-Code AVP from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
int cxdx_get_experimental_result_code(AAAMessage *msg, int *data);
/**
* Returns the Server-Name AVP from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
str cxdx_get_server_name(AAAMessage *msg);
/**
* Returns the Capabilities from the grouped AVP from a Diameter message.
* @param msg - the Diameter message
* @param m - array to be filled with the retrieved mandatory capabilities
* @param m_cnt - size of the array above to be filled
* @param o - array to be filled with the retrieved optional capabilities
* @param o_cnt - size of the array above to be filled
* @returns 1 on success 0 on fail
*/
int cxdx_get_capabilities(AAAMessage *msg, int **m, int *m_cnt, int **o,
int *o_cnt, str **p, int *p_cnt);
/**
* Creates and adds a SIP-Number-Auth-Items AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_sip_number_auth_items(AAAMessage *msg, unsigned int data);
/**
* Creates and adds a SIP-Auth-Data-Item AVP.
* @param msg - the Diameter message to add to.
* @param auth_scheme - the value for the authorization scheme AVP
* @param auth - the value for the authorization AVP
* @returns 1 on success or 0 on error
*/
int cxdx_add_sip_auth_data_item_request(AAAMessage *msg, str auth_scheme,
str auth, str username, str realm, str method, str server_name);
/**
* Creates and adds a Server-Name AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_server_name(AAAMessage *msg, str data);
/**
* Returns the SIP-Number-Auth-Items AVP from a Diameter message.
* @param msg - the Diameter message
* @returns the number or 0 on error
*/
int cxdx_get_sip_number_auth_items(AAAMessage *msg, int *data);
/**
* Returns the Auth-Data-Item from a Diameter answer message.
* @param msg - the Diameter message
* @param auth_date - the string to fill with the authorization data
* @param item_number - the int to fill with the item number
* @param auth_scheme - the string to fill with the authentication scheme data
* @param authenticate - the string to fill with the authenticate data
* @param authorization - the string to fill with the authorization data
* @param ck - the string to fill with the cipher key
* @param ik - the string to fill with the integrity key
* @returns the AVP payload on success or an empty string on error
*/
int cxdx_get_auth_data_item_answer(AAAMessage *msg, AAA_AVP **auth_data,
int *item_number, str *auth_scheme, str *authenticate,
str *authorization, str *ck, str *ik, str *ip, str *ha1,
str *response_auth, str *digest_realm, str *line_identifier);
/**
* Creates and adds an ETSI_sip_authorization AVP.
* @param username - UserName
* @param realm - Realm
* @param nonce - Nonce
* @param URI - URI
* @param response - Response
* @param algorithm - Algorithm
* @param method - Method
* @param hash - Enitity-Body-Hash
* @returns grouped str on success
*/
str cxdx_ETSI_sip_authorization(str username, str realm, str nonce, str URI,
str response, str algorithm, str method, str hash);
/**
* Returns the User-Data from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
str cxdx_get_user_data(AAAMessage *msg);
/**
* Returns the Charging-Information from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
int cxdx_get_charging_info(
AAAMessage *msg, str *ccf1, str *ccf2, str *ecf1, str *ecf2);
/**
* Creates and adds a Server-Assignment-Type AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_server_assignment_type(AAAMessage *msg, unsigned int data);
/**
* Creates and adds Userdata-Available AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_userdata_available(AAAMessage *msg, unsigned int data);
/**
* Finds out the next Public-Identity AVP from a Diameter message.
* @param msg - the Diameter message
* @param pos - position to resume search or NULL if to start from the first AVP
* @param avp_code - the code of the AVP to look for
* @param vendor_id - the vendor id of the AVP to look for
* @param func - the name of the calling function for debugging purposes
* @returns the AVP payload on success or an empty string on error
*/
AAA_AVP *cxdx_get_next_public_identity(AAAMessage *msg, AAA_AVP *pos,
int avp_code, int vendor_id, const char *func);
/**
* Returns the User-Name AVP from a Diameter message.
* @param msg - the Diameter message
* @returns the AVP payload on success or an empty string on error
*/
str cxdx_get_user_name(AAAMessage *msg);
/**
* Creates and adds a Result-Code AVP.
* @param msg - the Diameter message to add to.
* @param data - the value for the AVP payload
* @returns 1 on success or 0 on error
*/
int cxdx_add_result_code(AAAMessage *msg, unsigned int data);
/**
* Transactional SIP response - tries to create a transaction if none found.
* @param msg - message to reply to
* @param code - the Status-code for the response
* @param text - the Reason-Phrase for the response
* @returns the tmb.t_reply() result
*/
int cscf_reply_transactional(struct sip_msg *msg, int code, char *text);
#endif /* IS_CSCF_CXDX_AVP_H */