#ifndef _SIP_CONST__H
#define _SIP_CONST__H

#define    SIP_TCP_BACKLOG				64

#define    SIP_MAX_NUM_OF_TCP_SOCK		512

#define    SIP_MAX_NUM_OF_USERS			4

#define    SIP_MAX_NUM_OF_SIP_UA_USER       4

#define    SIP_MAX_NUM_OF_TRANS_1		4095//8191

#define    SIP_MAX_TCP_MSG_LEN			1500

#define    SIP_MAX_UDP_MSG_LEN			1500
#define    SIP_MAX_UDP_MSG_GET_TIMES	64

#define    SIP_MAX_ESCAPE_BUF_LEN		64

#define    SIP_STR_TO_API				1
#define    SIP_API_TO_STR				2

#define    SIP_MESSAGE_BODY_FLAG	1
#define    SIP_SUB_BODY_FLAG			2

#define    SIP_COMMAND_IDLE			0

#define    SIP_VERSION_2_0				20

#define    SIP_MIME_VERSION_1_0			10

#define    SIP_HASH_TABLE_SIZE 			200     // 150 is the first size where no conflicts occur
#define    SIP_MAX_NUM_OF_HEADERS		48

#define    SIP_HNAME_ACCEPT						"accept"
#define    SIP_HNAME_ACCEPT_ENCODING			"accept-encoding"
#define    SIP_HNAME_ACCEPT_LANGUAGE			"accept-language"
#define    SIP_HNAME_ALERT_INFO					"alert-info"
#define    SIP_HNAME_ALLOW						"allow"
#define    SIP_HNAME_AUTHENTICATION_INFO		"authentication-info"
#define    SIP_HNAME_AUTHORIZATION				"authorization"
#define    SIP_HNAME_CALL_ID						"call-id"
#define    SIP_HNAME_CALL_ID_SHORT				"i"
#define    SIP_HNAME_CALL_INFO					"call-info"
#define    SIP_HNAME_CONTACT						"contact"
#define    SIP_HNAME_CONTACT_SHORT				"m"
#define    SIP_HNAME_CONTENT_DISPOSITION		"content-disposition"
#define    SIP_HNAME_CONTENT_ENCODING_SHORT	"e"
#define    SIP_HNAME_CONTENT_ENCODING			"content-encoding"
#define    SIP_HNAME_CONTENT_LANGUAGE			"content-language"
#define    SIP_HNAME_CONTENT_LENGTH_SHORT		"l"
#define    SIP_HNAME_CONTENT_LENGTH				"content-length"
#define    SIP_HNAME_CONTENT_TYPE_SHORT		"c"
#define    SIP_HNAME_CONTENT_TYPE				"content-type"
#define    SIP_HNAME_CSEQ							"cseq"
#define    SIP_HNAME_SIPDATE						"date"
#define    SIP_HNAME_ERROR_INFO					"error-info"
#define    SIP_HNAME_EVENT                      "event"
#define    SIP_HNAME_EXPIRES						"expires"
#define    SIP_HNAME_FROM							"from"
#define    SIP_HNAME_FROM_SHORT					"f"
#define    SIP_HNAME_IN_REPLY_TO					"in-reply-to"
#define    SIP_HNAME_MAX_FORWARDS				"max-forwards"
#define    SIP_HNAME_MIME_VERSION				"mime-version"
#define    SIP_HNAME_MIN_EXPIRES					"min-expires"
#define    SIP_HNAME_ORGANIZATION				"organization"
#define    SIP_HNAME_PRIORITY						"priority"
#define    SIP_HNAME_PROXY_AUTHENTICATE			"proxy-authenticate"
#define    SIP_HNAME_PROXY_AUTHENTICATION_INFO	"proxy-authentication-info"
#define    SIP_HNAME_PROXY_AUTHORIZATION		"proxy-authorization"
#define    SIP_HNAME_PROXY_REQUIRE				"proxy-require"
#define    SIP_HNAME_RECORD_ROUTE				"record-route"
#define    SIP_HNAME_REFER_TO                   "refer-to"
#define    SIP_HNAME_REFER_TO_SHORT             "r"
#define    SIP_HNAME_REPLY_TO						"reply-to"
#define    SIP_HNAME_REQUIRE						"require"
#define    SIP_HNAME_RETRY_AFTER					"retry-after"
#define    SIP_HNAME_ROUTE						"route"
#define    SIP_HNAME_SERVER						"server"
#define    SIP_HNAME_SUBJECT						"subject"
#define    SIP_HNAME_SUBJECT_SHORT				"s"
#define    SIP_HNAME_SUPPORTED					"supported"
#define    SIP_HNAME_SUPPORTED_SHORT			"k"
#define    SIP_HNAME_SUBSCRIPTION_STATE         "subscription-state"
#define    SIP_HNAME_TIMESTAMP					"timestamp"
#define    SIP_HNAME_TO							"to"
#define    SIP_HNAME_TO_SHORT					"t"
#define    SIP_HNAME_UNSUPPORTED				"unsupported"
#define    SIP_HNAME_USER_AGENT					"user-agent"
#define    SIP_HNAME_VIA							"via"
#define    SIP_HNAME_VIA_SHORT					"v"
#define    SIP_HNAME_WARNING						"warning"
#define    SIP_HNAME_WWW_AUTHENTICATE			"www-authenticate"
#define    SIP_HNAME_MAX_FORWARDS				"max-forwards"

#define	SIP_TRANS_MAIN_STATE_INIT			0
#define	SIP_TRANS_MAIN_STATE_SVR_NON_INV	1
#define	SIP_TRANS_MAIN_STATE_SVR_INV		2
#define	SIP_TRANS_MAIN_STATE_CLT_NON_INV	3
#define	SIP_TRANS_MAIN_STATE_CLT_INV		4

#define	SIP_TRANS_STATE_IDLE					0
#define	SIP_TRANS_STATE_TRYING				1
#define	SIP_TRANS_STATE_CALLING				2
#define	SIP_TRANS_STATE_PROCEEDING			3
#define	SIP_TRANS_STATE_COMPLETED			4
#define	SIP_TRANS_STATE_CONFIRMED			5
#define	SIP_TRANS_STATE_TERMINATED			6

#define SIP_PNAME_TAG						"tag"
#define SIP_PNAME_BRANCH					"branch"
#define SIP_PNAME_EXPIRES					"expires"
#define SIP_PNAME_USER						"user"
#define SIP_PNAME_LR						"lr"
#define SIP_PNAME_BOUNDARY				"boundary"
#define SIP_PNAME_HANDLING				"handling"
#define SIP_PNAME_TRANSPORT				"transport"
#define SIP_PNAME_RPORT					"rport"
#define SIP_PNAME_VERSION					"version"
#define SIP_PNAME_BASE						"base"

#define SIP_TIMER_T1						25				// default: 500 ms
#define SIP_TIMER_T2						400					// default: 4 s
#define SIP_TIMER_T4						500					// default: 5 s
#define SIP_TIMER_A							SIP_TIMER_T1
#define SIP_TIMER_B							(128 * SIP_TIMER_T1)//(64 * SIP_TIMER_T1)
#define SIP_TIMER_D							(32 *SIP_TIMER_T1)//(64 * SIP_TIMER_T1)//
#define SIP_TIMER_E_INITIAL					SIP_TIMER_T1
#define SIP_TIMER_F							(32 * SIP_TIMER_T1)//(64 * SIP_TIMER_T1)//
#define SIP_TIMER_G							SIP_TIMER_T1
#define SIP_TIMER_H							(32 * SIP_TIMER_T1)//(64 * SIP_TIMER_T1)//
#define SIP_TIMER_I							2//SIP_TIMER_T4
#define SIP_TIMER_J							(32 * SIP_TIMER_T1)//(64 * SIP_TIMER_T1)//
#define SIP_TIMER_K							2//SIP_TIMER_T4
#define SIP_TIMER_200MS						20

#define SIP_ENCODE_URL_ALL						0x00
#define SIP_ENCODE_URL_NO_BRACKETS			0x01
#define SIP_ENCODE_URL_NO_USER_PART			0x02

#define SIP_BRANCH_BASE_TRANS_ID			10000
#define SIP_BRANCH_BASE_TRANS_ID_LEN		5

#define SIP_MAX_ASCIIIN_LEN					4096
#define SIP_MAX_ASCIIOUT_LEN				 	4096
#define SIP_MAX_ASCITMP_LEN					4096

#define	SIP_MONITOR_NONE							0x0000
#define	MONITOR_SIP_MSG						0x0001
#define	SIP_MONITOR_ERROR							0x0002
#define	SIP_MONITOR_ALL							0xffff

#endif
