100 lines
2.7 KiB
C
100 lines
2.7 KiB
C
/***************************************************************************************
|
|
*
|
|
* 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_HSIP_H
|
|
#define H_HSIP_H
|
|
|
|
/***************************************************************************************/
|
|
|
|
#include "sip_inc.h"
|
|
#include "sip_trans.h"
|
|
#include "hqueue.h"
|
|
|
|
|
|
/***************************************************************************************/
|
|
typedef struct hsip_class
|
|
{
|
|
uint32 sys_init_flag : 8;
|
|
uint32 sys_timer_run : 1;
|
|
uint32 flag_reserved : 23;
|
|
|
|
char ver[128]; // 版本信息
|
|
|
|
HQUEUE * msg_queue; // 消息接收队列
|
|
|
|
//---- 网络部分 ---------------
|
|
char local_ipstr[24];
|
|
uint32 local_ip;
|
|
|
|
char host_name[128]; // 主机名称或者本域名称
|
|
|
|
STRANS sip_trans; // 消息事务管理单元
|
|
|
|
uint32 net_rx_flag; // 网络接收任务循环标识
|
|
pthread_t net_rx_tid; // 线程ID
|
|
|
|
//---- 呼叫项------------
|
|
PPSN_CTX * sua_fl;
|
|
PPSN_CTX * sua_ul;
|
|
pthread_t sip_task_tid; // 线程ID
|
|
|
|
//---- 本地用户部分------------
|
|
uint32 user_expires_sec; // 用户注册有效时间
|
|
|
|
pthread_t timer_id; // 定时器任务
|
|
|
|
HSIP_CRPTY_MODE crypt_mode; // 消息加密模式
|
|
|
|
void * mutex_cb; // 回调函数设置锁
|
|
SIPNTFC ext_ntf_func; // 向外部进行状态通知的功能函数,由调用者设置
|
|
void * user_data; // 通知回调函数用户自定义数据
|
|
}HSIP_CLASS;
|
|
|
|
typedef struct rx_msg_context
|
|
{
|
|
char from[64];
|
|
int type; // 0: 普通文本, 1: HTML, 2: XML; BASE64编码在协议栈中处理
|
|
int dlen;
|
|
char p_data[4];
|
|
} RMSGCTX;
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
BOOL sip_start();
|
|
void sip_stop();
|
|
BOOL sip_user_socket_init(HSIP_USER * p_user);
|
|
BOOL sip_tcp_reconnect_commit();
|
|
BOOL is_local_if_ip(uint32 dst_ip);
|
|
BOOL is_local_domain(char * domain);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // H_HSIP_H
|
|
|
|
|
|
|