Module: sip-router Branch: daniel/pv Commit: 3247010ccea606a386cf24e00083dc38ae8b43c2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3247010c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Thu Nov 20 14:45:47 2008 +0200
PV get null helper added
- PV get null helper function required to stay in the API - removed unused PV types - now AVP type is used to detect the type of parameters, some related to R-URI are used by avpops, to be added if a different solution is not found. Would be hard to manage the types in core and do the implementation in module.
---
pvapi.c | 23 ++++++++++++++++++----- pvar.h | 35 ++++------------------------------- 2 files changed, 22 insertions(+), 36 deletions(-)
diff --git a/pvapi.c b/pvapi.c index f6c6399..eb4ea7a 100644 --- a/pvapi.c +++ b/pvapi.c @@ -1,16 +1,16 @@ /* - * $Id: items.h 2111 2007-05-01 11:18:08Z juhe $ + * $Id$ * * Copyright (C) 2001-2003 FhG Fokus * - * This file is part of Kamailio, a free SIP server. + * This file is part of SIP-Router, a free SIP server. * - * Kamailio is free software; you can redistribute it and/or modify + * SIP-Router 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, + * SIP-Router 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. @@ -296,7 +296,20 @@ static str pv_str_marker = { PV_MARKER_STR, 1 }; static int pv_get_marker(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { - return pv_get_strintval(msg, param, res, &pv_str_marker, (int)pv_str_marker.s[0]); + return pv_get_strintval(msg, param, res, &pv_str_marker, + (int)pv_str_marker.s[0]); +} + +static str pv_str_empty = { "", 0 }; +int pv_get_null(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) +{ + if(res==NULL) + return -1; + + res->rs = pv_str_empty; + res->ri = 0; + res->flags = PV_VAL_NULL; + return 0; }
pv_export_t* pv_lookup_spec_name(str *pvname, pv_spec_p e) diff --git a/pvar.h b/pvar.h index fcf3982..be7b3bc 100644 --- a/pvar.h +++ b/pvar.h @@ -3,14 +3,14 @@ * * Copyright (C) 2001-2003 FhG Fokus * - * This file is part of Kamailio, a free SIP server. + * This file is part of SIP-Router, a free SIP server. * - * Kamailio is free software; you can redistribute it and/or modify + * SIP-Router 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, + * SIP-Router 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. @@ -72,34 +72,7 @@
enum _pv_type { PVT_NONE=0, PVT_EMPTY, PVT_NULL, - PVT_MARKER, PVT_AVP, PVT_HDR, - PVT_PID, PVT_RETURN_CODE, PVT_TIMES, - PVT_TIMEF, PVT_MSGID, PVT_METHOD, - PVT_STATUS, PVT_REASON, PVT_RURI, - PVT_RURI_USERNAME, PVT_RURI_DOMAIN, PVT_RURI_PORT, - PVT_FROM, PVT_FROM_USERNAME, PVT_FROM_DOMAIN, - PVT_FROM_TAG, PVT_TO, PVT_TO_USERNAME, - PVT_TO_DOMAIN, PVT_TO_TAG, PVT_CSEQ, - PVT_CONTACT, PVT_CALLID, PVT_USERAGENT, - PVT_MSG_BUF, PVT_MSG_LEN, PVT_FLAGS, - PVT_HEXFLAGS, PVT_SRCIP, PVT_SRCPORT, - PVT_RCVIP, PVT_RCVPORT, PVT_REFER_TO, - PVT_DSET, PVT_DSTURI, PVT_COLOR, - PVT_BRANCH, PVT_BRANCHES, PVT_CONTENT_TYPE, - PVT_CONTENT_LENGTH, PVT_MSG_BODY, PVT_AUTH_USERNAME, - PVT_AUTH_REALM, PVT_RURI_PROTOCOL, PVT_DSTURI_DOMAIN, - PVT_DSTURI_PORT, PVT_DSTURI_PROTOCOL, PVT_FROM_DISPLAYNAME, - PVT_TO_DISPLAYNAME, PVT_OURI, PVT_OURI_USERNAME, - PVT_OURI_DOMAIN, PVT_OURI_PORT, PVT_OURI_PROTOCOL, - PVT_FORCE_SOCK, PVT_RPID_URI, PVT_DIVERSION_URI, - PVT_ACC_USERNAME, PVT_PPI, PVT_PPI_DISPLAYNAME, - PVT_PPI_DOMAIN, PVT_PPI_USERNAME, PVT_PAI_URI, - PVT_BFLAGS, PVT_HEXBFLAGS, PVT_SFLAGS, - PVT_HEXSFLAGS, PVT_ERR_CLASS, PVT_ERR_LEVEL, - PVT_ERR_INFO, PVT_ERR_RCODE, PVT_ERR_RREASON, - PVT_SCRIPTVAR, PVT_PROTO, PVT_AUTH_USERNAME_WHOLE, - PVT_AUTH_DURI, PVT_DIV_REASON, PVT_DIV_PRIVACY, - PVT_AUTH_DOMAIN, PVT_OTHER, + PVT_MARKER, PVT_AVP, PVT_OTHER, PVT_EXTRA /* keep it last */ };