/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2014-2022, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************************/ #ifndef H_SIP_PARSE_H #define H_SIP_PARSE_H #include "sua_sdp.h" /*************************************************************************/ typedef struct { SIP_MT msg_type; char msg_str[32]; int msg_len; } REQMTV; #ifdef __cplusplus extern "C" { #endif /*************************************************************************/ BOOL sip_is_sip_msg(char * msg_buf); void sip_headl_parse(char * pline, int llen, HSIP_MSG * p_msg); int sip_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx); int sip_ctx_parse(HSIP_MSG * p_msg); int sip_msg_parse(char * msg_buf, int msg_buf_len, HSIP_MSG * msg); int sip_msg_parse_part1(char * p_buf,int buf_len, HSIP_MSG * msg); int sip_msg_parse_part2(char * p_buf,int buf_len, HSIP_MSG * msg); HSIP_VIAH * sip_msg_via_parse(char * via_content_buf); /*************************************************************************/ HDRV * sip_find_headline(HSIP_MSG * msg, const char * head); HDRV * sip_find_sdp_headline(HSIP_MSG * msg, const char * head); BOOL sip_msg_with_sdp(HSIP_MSG * msg); BOOL sip_get_msg_call_id(HSIP_MSG * rx_msg, char *callid_buf, int len); BOOL sip_get_msg_cseq(HSIP_MSG * rx_msg, char *cseq_buf, int len); BOOL sip_get_msg_cseq_type(HSIP_MSG * rx_msg, char *type_buf, int len); BOOL sip_get_session_timer_info(HSIP_MSG * rx_msg, int * expires, int * min_se, int * refresher); BOOL sip_get_msg_expires(HSIP_MSG * rx_msg, char *expires_buf, int len); BOOL sip_get_disp_name(HSIP_MSG * rx_msg, const char *ft, char * disp_name, int len); BOOL sip_get_user_name(HSIP_MSG * rx_msg, const char *ft, char * user_name, int len); BOOL sip_get_user_domain(HSIP_MSG * rx_msg, const char *ft, char * domain, int len); BOOL sip_get_sip_address(HSIP_MSG * rx_msg, const char *ft, char * sip_address, int len); BOOL sip_get_user_tag(HSIP_MSG * rx_msg, const char *ft, char * tag, int len); BOOL sip_get_req_name(HSIP_MSG * rx_msg, char * req_name, int len); BOOL sip_get_user_contact_uri(HSIP_MSG * rx_msg, char * uri_buf, int max_len); BOOL sip_get_server_info(HSIP_MSG * rx_msg, char * srv_buf, int max_len); BOOL sip_get_content_type(HSIP_MSG * rx_msg, char * bufs, int len); void sip_add_tx_msg_line(HSIP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt,...); void sip_add_tx_msg_sdp_line(HSIP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt,...); void sip_add_tx_msg_fline(HSIP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt,...); void sip_add_tx_msg_via(HSIP_MSG * tx_msg, const char * msg_fmt,...); void sip_copy_msg_via(HSIP_MSG * src_msg, HSIP_MSG * dst_msg); void sip_save_rx_via(HSIP_MSG * rx_msg, PPSN_CTX * dst_ctx); void sip_copy_via_tx(PPSN_CTX * src_ctx, HSIP_MSG * tx_msg); void sip_new_ua_via(PPSN_CTX * dst_ctx, char * ua_ipstr, uint16 ua_port, int is_tcp); void sip_save_rx_rr(HSIP_MSG * rx_msg, PPSN_CTX * dst_ctx); void sip_copy_msg_line(HSIP_MSG * src_msg, HSIP_MSG * dst_msg, const char * msg_hdr); void sip_free_msg(HSIP_MSG * msg); void sip_free_msg_content(HSIP_MSG * msg); void sip_free_msg_ctx(HSIP_MSG * msg, int type); void sip_free_msg_via_ctx(HSIP_MSG * msg); void sip_free_ua_via_ctx(PPSN_CTX * p_via_ctx); void sip_free_ua_rr_ctx(PPSN_CTX * p_rr_ctx); CSEVT sip_get_msg_event(HSIP_MSG * rx_msg); BOOL sip_get_remote_media_ip(HSIP_MSG * rx_msg, uint32 * media_ip); BOOL sip_get_remote_rtp_mux_info(HSIP_MSG * rx_msg, uint32 * mux_id); BOOL sip_get_sdp_setup_mode(HSIP_MSG * rx_msg, const char * cap_name, int * mode); BOOL sip_get_sdp_session_name(HSIP_MSG * rx_msg, char * sbuf, int mlen); BOOL sip_get_sdp_uname(HSIP_MSG * rx_msg, char * uname, int ulen); BOOL sip_get_sdp_ttime(HSIP_MSG * rx_msg, uint32 * p_st, uint32 * p_et); BOOL sip_get_sdp_yname(HSIP_MSG * rx_msg, char * yname, int ylen); HDRV * sip_find_mdesc_point(HSIP_MSG * rx_msg, HDRV * pStartHdr, const char * cap_name,int * next_offset); BOOL sip_get_remote_cap(HSIP_MSG * rx_msg, int m_index, const char * cap_name, int * cap_count, uint8 * cap_array, uint16 * rtp_port, int * is_tcp); BOOL sip_get_remote_cap_desc(HSIP_MSG * rx_msg, const char * cap_name, char cap_desc[][MAX_AVDESCLEN]); SDPINFO * sip_sdp_codec_find_pt(SDPINFO * p_ary, int ary_cnt, const char * codec_name); SDPINFO * sip_sdp_pt_find(SDPINFO * p_ary, int ary_cnt, int pt); BOOL sip_sdp_media_desc_parse(HSIP_MSG * rx_msg, int m_index, const char * cap_name, int cap_cnt, uint8 * cap_array, SDPINFO * p_ary, uint32 * ipv4); /*************************************************************************/ void sip_gs_msg_crypt(char * buf, int len); void sip_gs_msg_crypt_all(char * buf, int len); void sip_gs_cbcom_init(); BOOL sip_gs_is_cbcom(char * msg_buf, int len); /*************************************************************************/ void sip_hsp_msg_crypt(char * buf, int len); void sip_hsp_msg_crypt_all(char * buf, int len); void sip_hsp_crypt_init(); BOOL sip_hsp_is_crypt(char * msg_buf, int len); /*************************************************************************/ void sip_msg_crpty(char * msg_buf, int msg_buf_len, HSIP_MSG * msg); /*************************************************************************/ BOOL sip_via_buf_fl_init(int num); void sip_via_buf_fl_deinit(); HSIP_VIAH * sip_get_via_buf(); void sip_init_ul_via_ctx(PPSN_CTX * ul_ctx); void sip_free_via_buf(HSIP_VIAH * pVia); BOOL sip_msg_buf_fl_init(int num); void sip_msg_buf_fl_deinit(); HSIP_MSG * sip_get_msg_buf(); void sip_msg_ctx_init(HSIP_MSG * msg); void sip_free_msg_buf(HSIP_MSG * msg); HSIP_MSG * sip_get_msg_large_buf(int size); BOOL sip_parse_buf_init(int nums); void sip_parse_buf_deinit(); #ifdef __cplusplus } #endif #endif // H_SIP_PARSE_H