diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-07-31 19:10:41 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-07-31 19:10:41 +0000 |
commit | e5210366e45056e56c27c902ad63a479d5ae7005 (patch) | |
tree | 95c252ea087da6de7e0bd709f605afd1249b4932 /channels/sip | |
parent | b83500ab613fbaae4c5da0e434a5803c5ec60a09 (diff) |
Clean up chan_sip
This clean up was broken out from
https://reviewboard.asterisk.org/r/1976/ and addresses the following:
- struct sip_refer converted to use the stringfields API.
- sip_{refer|notify}_allocate -> sip_{notify|refer}_alloc to match
other *alloc functions.
- Replace get_msg_text, get_msg_text2 and get_pidf_body -> No, not
get_pidf_msg_text_body3 but get_content, to match add_content.
- get_body doesn't get the request body, renamed to get_content_line.
- get_body_by_line doesn't get the body line, and is just a simple if
test. Moved code inline and removed function.
- Remove camelCase in struct sip_peer peer state variables,
onHold -> onhold, inUse -> inuse, inRinging -> ringing.
- Remove camelCase in struct sip_request rlPart1 -> rlpart1,
rlPart2 -> rlpart2.
- Rename instances of pvt->randdata to pvt->nonce because that is what
it is, no need to update struct sip_pvt because _it already has a
nonce field_.
- Removed struct sip_pvt randdata stringfield.
- Remove useless (and inconsistent) 'header' suffix on variables in
handle_request_subscribe.
- Use ast_strdupa on Event header in handle_request_subscribe to avoid
overly complicated strncmp calls to find the event package.
- Move get_destination check in handle_request_subscribe to avoid
duplicate checking for packages that don't need it.
- Move extension state callback management in handle_request_subscribe
to avoid duplicate checking for packages that don't need it.
- Remove duplicate append_date prototype.
- Rename append_date -> add_date to match other add_xxx functions.
- Added add_expires helper function, removed code that manually added
expires header.
- Remove _header suffix on add_diversion_header (no other header adding
functions have this).
- Don't pass req->debug to request handle_request_XXXXX handlers if req
is also being passed.
- Don't pass req->ignore to check_auth as req is already being passed.
- Don't create a subscription in handle_request_subscribe if
p->expiry == 0.
- Don't walk of the back of referred_by_name when splitting string in
get_refer_info
- Remove duplicate check for no dialog in handle_incoming when
sipmethod == SIP_REFER, handle_request_refer checks for that.
Review: https://reviewboard.asterisk.org/r/1993/
Patch-by: gareth
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip')
-rw-r--r-- | channels/sip/include/sip.h | 58 | ||||
-rw-r--r-- | channels/sip/security_events.c | 6 |
2 files changed, 32 insertions, 32 deletions
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h index 76766fb17..6f75f97e3 100644 --- a/channels/sip/include/sip.h +++ b/channels/sip/include/sip.h @@ -785,14 +785,14 @@ struct sip_socket { * Then call parse_request() and req.method = find_sip_method(); * to initialize the other fields. The \r\n at the end of each line is * replaced by \0, so that data[] is not a conforming SIP message anymore. - * After this processing, rlPart1 is set to non-NULL to remember + * After this processing, rlpart1 is set to non-NULL to remember * that we can run get_header() on this kind of packet. * * parse_request() splits the first line as follows: * Requests have in the first line method uri SIP/2.0 - * rlPart1 = method; rlPart2 = uri; + * rlpart1 = method; rlpart2 = uri; * Responses have in the first line SIP/2.0 NNN description - * rlPart1 = SIP/2.0; rlPart2 = NNN + description; + * rlpart1 = SIP/2.0; rlpart2 = NNN + description; * * For outgoing packets, we initialize the fields with init_req() or init_resp() * (which fills the first line to "METHOD uri SIP/2.0" or "SIP/2.0 code text"), @@ -802,8 +802,8 @@ struct sip_socket { * \endverbatim */ struct sip_request { - ptrdiff_t rlPart1; /*!< Offset of the SIP Method Name or "SIP/2.0" protocol version */ - ptrdiff_t rlPart2; /*!< Offset of the Request URI or Response Status */ + ptrdiff_t rlpart1; /*!< Offset of the SIP Method Name or "SIP/2.0" protocol version */ + ptrdiff_t rlpart2; /*!< Offset of the Request URI or Response Status */ int headers; /*!< # of SIP Headers */ int method; /*!< Method of this request */ int lines; /*!< Body Content */ @@ -824,7 +824,7 @@ struct sip_request { /* \brief given a sip_request and an offset, return the char * that resides there * - * It used to be that rlPart1, rlPart2, and the header and line arrays were character + * It used to be that rlpart1, rlpart2, and the header and line arrays were character * pointers. They are now offsets into the ast_str portion of the sip_request structure. * To avoid adding a bunch of redundant pointer arithmetic to the code, this macro is * provided to retrieve the string at a particular offset within the request's buffer @@ -918,26 +918,27 @@ struct _map_x_s { const char *s; }; -/*! \brief Structure to handle SIP transfers. Dynamically allocated when needed - \note OEJ: Should be moved to string fields */ +/*! \brief Structure to handle SIP transfers. Dynamically allocated when needed */ struct sip_refer { - char refer_to[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO extension */ - char refer_to_domain[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO domain */ - char refer_to_urioption[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO uri options */ - char refer_to_context[AST_MAX_EXTENSION]; /*!< Place to store REFER-TO context */ - char referred_by[AST_MAX_EXTENSION]; /*!< Place to store REFERRED-BY extension */ - char referred_by_name[AST_MAX_EXTENSION]; /*!< Place to store REFERRED-BY extension */ - char refer_contact[AST_MAX_EXTENSION]; /*!< Place to store Contact info from a REFER extension */ - char replaces_callid[SIPBUFSIZE]; /*!< Replace info: callid */ - char replaces_callid_totag[SIPBUFSIZE/2]; /*!< Replace info: to-tag */ - char replaces_callid_fromtag[SIPBUFSIZE/2]; /*!< Replace info: from-tag */ - struct sip_pvt *refer_call; /*!< Call we are referring. This is just a reference to a - * dialog owned by someone else, so we should not destroy - * it when the sip_refer object goes. - */ - int attendedtransfer; /*!< Attended or blind transfer? */ - int localtransfer; /*!< Transfer to local domain? */ - enum referstatus status; /*!< REFER status */ + AST_DECLARE_STRING_FIELDS( + AST_STRING_FIELD(refer_to); /*!< Place to store REFER-TO extension */ + AST_STRING_FIELD(refer_to_domain); /*!< Place to store REFER-TO domain */ + AST_STRING_FIELD(refer_to_urioption); /*!< Place to store REFER-TO uri options */ + AST_STRING_FIELD(refer_to_context); /*!< Place to store REFER-TO context */ + AST_STRING_FIELD(referred_by); /*!< Place to store REFERRED-BY extension */ + AST_STRING_FIELD(referred_by_name); /*!< Place to store REFERRED-BY extension */ + AST_STRING_FIELD(refer_contact); /*!< Place to store Contact info from a REFER extension */ + AST_STRING_FIELD(replaces_callid); /*!< Replace info: callid */ + AST_STRING_FIELD(replaces_callid_totag); /*!< Replace info: to-tag */ + AST_STRING_FIELD(replaces_callid_fromtag); /*!< Replace info: from-tag */ + ); + struct sip_pvt *refer_call; /*!< Call we are referring. This is just a reference to a + * dialog owned by someone else, so we should not destroy + * it when the sip_refer object goes. + */ + int attendedtransfer; /*!< Attended or blind transfer? */ + int localtransfer; /*!< Transfer to local domain? */ + enum referstatus status; /*!< REFER status */ }; /*! \brief Struct to handle custom SIP notify requests. Dynamically allocated when needed */ @@ -1006,7 +1007,6 @@ struct sip_pvt { AST_STRING_FIELD(callid); /*!< Global CallID */ AST_STRING_FIELD(initviabranch); /*!< The branch ID from the topmost Via header in the initial request */ AST_STRING_FIELD(initviasentby); /*!< The sent-by from the topmost Via header in the initial request */ - AST_STRING_FIELD(randdata); /*!< Random data */ AST_STRING_FIELD(accountcode); /*!< Account code */ AST_STRING_FIELD(realm); /*!< Authorization realm */ AST_STRING_FIELD(nonce); /*!< Authorization nonce */ @@ -1304,9 +1304,9 @@ struct sip_peer { struct sip_auth_container *auth;/*!< Realm authentication credentials */ int amaflags; /*!< AMA Flags (for billing) */ int callingpres; /*!< Calling id presentation */ - int inUse; /*!< Number of calls in use */ - int inRinging; /*!< Number of calls ringing */ - int onHold; /*!< Peer has someone on hold */ + int inuse; /*!< Number of calls in use */ + int ringing; /*!< Number of calls ringing */ + int onhold; /*!< Peer has someone on hold */ int call_limit; /*!< Limit of concurrent calls */ int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */ int busy_level; /*!< Level of active channels where we signal busy */ diff --git a/channels/sip/security_events.c b/channels/sip/security_events.c index b4433d007..cde9f12f3 100644 --- a/channels/sip/security_events.c +++ b/channels/sip/security_events.c @@ -125,7 +125,7 @@ void sip_report_inval_password(const struct sip_pvt *p, const char *response_cha }, .common.session_id = session_id, - .challenge = p->randdata, + .challenge = p->nonce, .received_challenge = response_challenge, .received_hash = response_hash, }; @@ -206,7 +206,7 @@ void sip_report_failed_challenge_response(const struct sip_pvt *p, const char *r }, .common.session_id = session_id, - .challenge = p->randdata, + .challenge = p->nonce, .response = response, .expected_response = expected_response, }; @@ -242,7 +242,7 @@ void sip_report_chal_sent(const struct sip_pvt *p) }, .common.session_id = session_id, - .challenge = p->randdata, + .challenge = p->nonce, }; if (!ast_strlen_zero(p->from)) { /* When dialing, show account making call */ |