Copyright (C) 2007 PT Inovacao
Definition in file privacy.c.
#include "../tm/tm_load.h"
#include "mod.h"
#include "sip.h"
#include "privacy.h"
Go to the source code of this file.
Functions | |
| int | apply_privacy_id (struct sip_msg *msg) |
| Applies Privacy for P-Asserted-Identity. | |
| void | privacy_reply_cb (struct cell *t, int type, struct tmcb_params *ps) |
| Privacy reply tm callback. | |
| int | S_apply_privacy (struct sip_msg *msg, char *str1, char *str2) |
| Applies Privacy if needed. | |
| int | S_privacy_hook (struct sip_msg *msg, char *str1, char *str2) |
| Registers tm callback to apply privacy to replies. | |
Variables | |
| tm_binds | tmb |
| Structure with pointers to tm funcs. | |
| static str | asserted_identity = {"P-Asserted-Identity",19} |
| static str | privacy = {"Privacy",7} |
| int apply_privacy_id | ( | struct sip_msg * | msg | ) |
Applies Privacy for P-Asserted-Identity.
| msg | - the SIP message |
Definition at line 70 of file privacy.c.
References asserted_identity, cscf_del_header(), cscf_get_next_header(), CSCF_RETURN_FALSE, CSCF_RETURN_TRUE, M_NAME, and NULL.
Referenced by S_apply_privacy().
00070 { 00071 struct hdr_field *hdr; 00072 00073 LOG(L_DBG, "DBG:"M_NAME": apply_privacy_id\n"); 00074 hdr = cscf_get_next_header(msg,asserted_identity,NULL); 00075 if (!hdr) return CSCF_RETURN_FALSE; 00076 do { 00077 cscf_del_header(msg,hdr); 00078 hdr=cscf_get_next_header(msg,asserted_identity,hdr); 00079 } while (hdr); 00080 00081 return CSCF_RETURN_TRUE; 00082 }
| void privacy_reply_cb | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ps | |||
| ) |
Privacy reply tm callback.
Applies Privacy if needed. Currently only supports "id" type. Registered by S_privacy_hook.
Definition at line 89 of file privacy.c.
References S_apply_privacy().
Referenced by S_privacy_hook().
00089 { 00090 S_apply_privacy(ps->rpl, 0, 0); 00091 }
| int S_apply_privacy | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) |
Applies Privacy if needed.
| msg | - the SIP message | |
| str1 | - not used | |
| str2 | - not used |
Definition at line 100 of file privacy.c.
References apply_privacy_id(), cscf_get_headers_content(), CSCF_RETURN_FALSE, M_NAME, and privacy.
Referenced by privacy_reply_cb().
00100 { 00101 char *c; 00102 int ret = CSCF_RETURN_FALSE; 00103 00104 str privacy_content = cscf_get_headers_content(msg,privacy); 00105 00106 if (!privacy_content.len){ 00107 ret = CSCF_RETURN_FALSE; 00108 goto done; 00109 } 00110 00111 LOG(L_DBG, "DBG:"M_NAME":S_apply_privacy\n"); 00112 c = strtok(privacy_content.s," \t\r\n;,"); 00113 while (c){ 00114 if (strlen(c)==2 && strncasecmp(c,"id",2)==0){ 00115 ret = apply_privacy_id(msg); 00116 break; 00117 } 00118 c = strtok(0," \t\r\n;,"); 00119 } 00120 00121 done: 00122 if (privacy_content.s) pkg_free(privacy_content.s); 00123 return ret; 00124 }
| int S_privacy_hook | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) |
Registers tm callback to apply privacy to replies.
| msg | - the SIP message | |
| str1 | - not used | |
| str2 | - not used |
Definition at line 133 of file privacy.c.
References cscf_get_transaction(), CSCF_RETURN_TRUE, privacy_reply_cb(), and tmb.
00133 { 00134 unsigned int a,b; 00135 00136 cscf_get_transaction(msg,&a,&b); 00137 tmb.register_tmcb(msg,0,TMCB_RESPONSE_IN,privacy_reply_cb,0); 00138 00139 return CSCF_RETURN_TRUE; 00140 }
str asserted_identity = {"P-Asserted-Identity",19} [static] |
str privacy = {"Privacy",7} [static] |
1.5.2