📄 nsrsbc.h
字号:
/* symbolic return state */
#define STS_SUCCESS 0 /* SUCCESS */
#define STS_TRUE 0 /* TRUE */
#define STS_FAILURE 1 /* FAILURE */
#define STS_FALSE 1 /* FALSE */
/*
* some constant definitions
*/
#define SIP_LISTENING_PORT 5060 /* default port to listen */
#define INTERFACE_SENDING_PORT 5065 /* default port to send message to interface */
#define INTERFACE_LISTENING_PORT 9010 /* default port to listen of interface */
#define DEFAULT_MAXFWD 70 /* default Max-Forward count */
#define DEFAULT_EXPIRES 60 /* default Expires timeout */
#define RTPPROXY_SIZE 128 /* number of rtp proxy entries */
/* this limits the number of calls! */
#define BUFFER_SIZE 8196 /* input buffer for read from socket */
#define RTP_BUFFER_SIZE 512 /* max size of an RTP frame */
#define URL_STRING_SIZE 128 /* max size of an URL/URI string */
#define STATUSCODE_SIZE 5 /* size of string representation of status */
#define IFADR_CACHE_SIZE 32 /* number of entries in internal IFADR cache */
#define IFADR_MAX_AGE 5 /* max. age of the IF address cache (sec) */
#define IFNAME_SIZE 16 /* max string length of a interface name */
#define HOSTNAME_SIZE 128 /* max string length of a hostname */
#define PORT_SIZE 6 /* max string length of a port number */
#define USERNAME_SIZE 128 /* max string length of a username (auth) */
#define PASSWORD_SIZE 128 /* max string length of a password (auth) */
#define VIA_BRANCH_SIZE 128 /* max string length for via branch param */
/* scratch buffer for gethostbyname_r() */
#define CALLID_SIZE 256 /* max string length of call id header */
#define PROTO_UNKN -1
#define PROTO_UDP 1
#define PROTO_TCP 2
#define REQTYP_INCOMING 1
#define REQTYP_OUTGOING 2
#define RESTYP_INCOMING 3
#define RESTYP_OUTGOING 4
/* symbolic direction of data */
#define DIR_INCOMING 1
#define DIR_OUTGOING 2
/*
* SIP ticket
*/
typedef struct {
osip_message_t *sipmsg; /* SIP */
struct sockaddr_in from; /* received from */
int protocol; /* received by protocol */
int direction; /* direction as determined by proxy */
}sip_ticket_t;
/* sip_sock.c */
int sipsock_listen(void);
int sipsock_wait(void);
int sipsock_read(void *buf, size_t bufsize, struct sockaddr_in *from, int *protocol);
int sipsock_send(struct in_addr addr, int port, int protocol, char *buffer, size_t size);
int sockbind(struct in_addr ipaddr, int localport);
/* proxy.c */
int proxy_request(sip_ticket_t *ticket);
int proxy_response(sip_ticket_t *ticket);
int proxy_rewrite_register(sip_ticket_t *ticket);
int proxy_rewrite_register_response(sip_ticket_t *ticket);
int sip_rewrite_sdp(sip_ticket_t *ticket, int direction);
char *osip_call_id_new_random(void);
/* sip_utils.c */
int sip_rewrite_requri(osip_message_t *mymsg, int type, int idx);
int sip_calculate_branch_id(sip_ticket_t *ticket, char *id);
int sip_find_direction(sip_ticket_t *ticket);
int is_via_local(osip_via_t *via);
int sip_add_myvia(sip_ticket_t *ticket);
int sip_del_myvia(sip_ticket_t *ticket);
int sip_rewrite_via(osip_message_t *mymsg, int type, int idx);
int sip_rewrite_contact(osip_message_t *mymsg);
int sip_rewrite_from(osip_message_t *mymsg, int type, int idx);
int sip_rewrite_to(osip_message_t *mymsg, int type, int idx);
int sip_rewrite_callid(osip_message_t *mymsg, char *ncid, int direction, int idx);
int sip_add_recordroute(sip_ticket_t *ticket);
int sip_del_route(sip_ticket_t *ticket);
int sip_purge_recordroute(sip_ticket_t *ticket);
int compare_callid(osip_call_id_t *cid1, osip_call_id_t *cid2);
/* accessctl.c */
int accesslist_check(struct sockaddr_in from);
/* rtpproxy.c */
int rtpproxy_init( void );
int rtp_start_fwd (osip_call_id_t *callid, char *client_id,
int direction, int media_stream_no,
struct in_addr outbound_ipaddr, int *outboundport,
struct in_addr lcl_client_ipaddr, int lcl_clientport);
int rtp_stop_fwd (osip_call_id_t *callid, int direction);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -