JunkBox_Lib 1.10.1
|
SIP用ライブラリヘッダ More...
#include "protocol.h"
Go to the source code of this file.
Macros | |
#define | SIP_NOMAXFORWARDS 1000 |
#define | get_sip_header_list(b) get_protocol_header_list((b), ':', TRUE, TRUE) |
#define | restore_sip_header(l) restore_protocol_header((l), ": ", ON, NULL) |
#define | restore_sip_contents(l) restore_protocol_contents((l)) |
Functions | |
void | set_sip_contents (tList *ls, Buffer sdp) |
Buffer | get_sip_via_address (tList *lp, int no) |
void | insert_sip_via (tList *lp, char *host, unsigned short port, char *branch, int mode) |
void | del_sip_via (tList *lp, char *host, unsigned short port) |
void | insert_sip_record_route (tList *lp, char *host, unsigned short port, int mode) |
void | del_sip_record_route (tList *lp, char *host, unsigned short port) |
void | del_sip_record_route_all (tList *lp) |
void | replace_sip_contact (tList *lp, char *host, unsigned short port) |
Buffer | get_sip_contact_uri (tList *lp) |
Buffer | get_sip_domain (Buffer cturi) |
int | get_max_forwards (tList *lp) |
void | set_max_forwards (tList *lp, int nm) |
tList * | get_sdp_body_list (tList *lp) |
Buffer | restore_sdp_body (tList *ls) |
int | replace_sdp_invite_addr (tList *lp, tList *ls, char *host, unsigned short port, int del_candi) |
unsigned short | get_valid_rtp_pair_sockets (int min, int max, int *rtp, int *rtcp) |
Buffer | replace_sip_via (tList *lp, char *host, unsigned short port, int no) |
int | replace_sip_contact_dstipport (tList *lp, char *ipaddr, unsigned short port) |
Definition in file sip_tool.h.
#define get_sip_header_list | ( | b | ) | get_protocol_header_list((b), ':', TRUE, TRUE) |
Definition at line 51 of file sip_tool.h.
#define restore_sip_contents | ( | l | ) | restore_protocol_contents((l)) |
Definition at line 53 of file sip_tool.h.
#define restore_sip_header | ( | l | ) | restore_protocol_header((l), ": ", ON, NULL) |
Definition at line 52 of file sip_tool.h.
#define SIP_NOMAXFORWARDS 1000 |
Definition at line 45 of file sip_tool.h.
Referenced by get_max_forwards().
void del_sip_record_route | ( | tList * | lp, |
char * | host, | ||
unsigned short | port ) |
void del_sip_record_route(tList* lp, char* host, unsigned short port)
Record-Routeヘッダでアドレス部が host:port (port==0の場合は host) で始まるものを全て削除する.
Definition at line 256 of file sip_tool.c.
References del_tList_node(), and LBUF.
void del_sip_record_route_all | ( | tList * | lp | ) |
void del_sip_record_route_all(tList* lp)
全ての Record-Routeヘッダを削除する.余計な情報を中継しないように.
Definition at line 288 of file sip_tool.c.
References del_tList_node().
void del_sip_via | ( | tList * | lp, |
char * | host, | ||
unsigned short | port ) |
void del_sip_via(tList* lp, char* host, unsigned short port)
Viaヘッダでアドレス部が host:port (port==0の場合は host) で始まるものを全て削除する.
Definition at line 171 of file sip_tool.c.
References Buffer::buf, cawk_Buffer(), del_tList_node(), free_Buffer(), and LBUF.
int get_max_forwards | ( | tList * | lp | ) |
int get_max_forwards(tList* lp)
Max-Forwardsヘッダの値を得る.ヘッダが無い場合は SIP_NOMAXFORWARDS が返る.
Definition at line 424 of file sip_tool.c.
References SIP_NOMAXFORWARDS, and strncasecmp_tList().
tList* get_sdp_body_list(tList* lp)
SDPボディをリスト構造に分解する.
Definition at line 473 of file sip_tool.c.
References FALSE, free_Buffer(), get_protocol_header_list(), and restore_protocol_contents().
Referenced by replace_sdp_invite_addr().
Buffer get_sip_contact_uri(tList* lp)
Contactヘッダの内容から SIP URI部分を抜き出す.
Contact: <sip:ABCDEFG@WWW.XXX.YYY.ZZZ:12345>;...... の <sip:ABCDEFG@WWW.XXX.YYY.ZZZ:12345> 部分を得る.
lp | SIPヘッダの情報のリスト形式 |
Definition at line 365 of file sip_tool.c.
References Buffer::buf, CHAR_CR, CHAR_LF, init_Buffer(), and search_protocol_header().
Buffer get_sip_domain(Buffer sipuri)
SIP URI からドメイン情報を抜き出す.
<sip:ABCDEFG@WWW.XXX.YYY.ZZZ:12345> のドメイン部分 WWW.XXX.YYY.ZZZ:12345 を得る.
sipuri | SIP URI 例:<sip:ABCDE.nosp@m.FG@W.nosp@m.WW.XX.nosp@m.X.YY.nosp@m.Y.ZZZ:12345> |
Definition at line 392 of file sip_tool.c.
References Buffer::buf, CHAR_CR, CHAR_LF, dup_Buffer(), free_Buffer(), init_Buffer(), and make_Buffer_bystr.
Buffer get_sip_via_address(tList* lp, int no)
no番目の Viaヘッダから有効なレスポンスアドレスを獲得する.received=,rport= 対応.
Definition at line 83 of file sip_tool.c.
References buf, Buffer::buf, comp_hostport(), dup_Buffer(), free_Buffer(), init_Buffer(), search_protocol_header_item(), and strstrcase().
unsigned short get_valid_rtp_pair_sockets | ( | int | min, |
int | max, | ||
int * | rtp, | ||
int * | rtcp ) |
unsigned short get_valid_rtp_pair_sockets(int min, int max, int* rtp, int* rtcp)
min〜max でランダムなポート番号を持った RTPとRTCPのソケットを生成する.
min | 使用可能なポート番号の最小値 |
max | 使用可能なポート番号の最大値 |
rtp | RTP のソケット番号が入る. |
rtcp | RTCPのソケット番号が入る. |
Definition at line 573 of file sip_tool.c.
References socket_close(), and udp_server_socket.
void insert_sip_record_route | ( | tList * | lp, |
char * | host, | ||
unsigned short | port, | ||
int | add_mode ) |
void insert_sip_record_route(tList* lp, char* host, unsigned short port, int add_mode)
Record-Route ヘッダを追加する.
Definition at line 205 of file sip_tool.c.
References add_tList_node_str, HDLIST_FIRST_LINE_KEY, LBUF, strncasecmp_tList(), strncmp_tList(), and strstrcase().
void insert_sip_via | ( | tList * | lp, |
char * | host, | ||
unsigned short | port, | ||
char * | branch, | ||
int | add_mode ) |
void insert_sip_via(tList* lp, char* host, unsigned short port, char* branch, int add_mode)
Viaヘッダを追加する.received=,rport= 未対応.
Definition at line 130 of file sip_tool.c.
References add_tList_node_str, buf, cat_s2Buffer, copy_s2Buffer, free_Buffer(), HDLIST_FIRST_LINE_KEY, LBUF, make_Buffer(), strncasecmp_tList(), and strncmp_tList().
int replace_sdp_invite_addr | ( | tList * | lp, |
tList * | ls, | ||
char * | host, | ||
unsigned short | port, | ||
int | del_candi ) |
int replace_sdp_invite_addr(tList*lp, tList* ls, char* host, unsigned short port, int del_candi)
INVITE用 SDPボディ内のアドレス情報を書き換える.
lp | SIPデータのリスト構造. |
ls | SDPデータのリスト構造.NULLの場合は lpから得る. |
host | 書き換え先のIPアドレス |
port | 書き換え先のポート番号 |
del_candi | TRUE: a=candidate行を削除する.(余計な情報を相手に送らないため) |
Definition at line 515 of file sip_tool.c.
References Buffer::buf, copy_i2Buffer(), del_tList(), del_tList_node(), FALSE, free_Buffer(), get_sdp_body_list(), LEN_INT, make_Buffer(), restore_sdp_body(), set_protocol_header_item, set_sip_contents(), and TRUE.
void replace_sip_contact | ( | tList * | lp, |
char * | host, | ||
unsigned short | port ) |
int replace_sip_contact(tList* lp, char* host, unsigned short port)
Contactヘッダのアドレス部を host:portまたは hostに書き換える.
Definition at line 308 of file sip_tool.c.
References buf, free_Buffer(), LBUF, replace_sBuffer, strncasecmp_tList(), and strstrcase().
int replace_sip_contact_dstipport | ( | tList * | lp, |
char * | ipaddr, | ||
unsigned short | port ) |
int replace_sip_contact_dstipport(tList* lp, char* ipaddr, unsigned short port)
Definition at line 658 of file sip_tool.c.
References Buffer::buf, cat_i2Buffer(), cat_s2Buffer, copy_s2Buffer, FALSE, free_Buffer(), LBUF, make_Buffer(), replace_sBuffer, search_protocol_header_partvalue(), strncasecmp_tList(), and TRUE.
Buffer replace_sip_via(tList* lp, char* host, unsigned short port, int no)
Viaヘッダーの IP:Port情報を書き換える
Definition at line 630 of file sip_tool.c.
References buf, init_Buffer(), LBUF, replace_protocol_header, and search_protocol_header_item().
Buffer restore_sdp_body(tList* ls)
リストからSDPボディを復元する.
Definition at line 488 of file sip_tool.c.
References buf, init_Buffer(), OFF, and restore_protocol_header().
Referenced by replace_sdp_invite_addr().
void set_max_forwards | ( | tList * | lp, |
int | nm ) |
void set_max_forwards(tList* lp, int nm)
Max-Forwardsヘッダがあれば,nmを設定する.
Definition at line 444 of file sip_tool.c.
References free_Buffer(), LEN_INT, make_Buffer_bystr, and strncasecmp_tList().
void set_sip_contents(tList* lp, Buffer sdp)
SDPボディをSIPのヘッダリストに再登録する.サイズの設定も行う.
Definition at line 52 of file sip_tool.c.
References LEN_INT, ON, set_protocol_contents(), set_protocol_header(), and Buffer::vldsz.
Referenced by replace_sdp_invite_addr().