📄 mgcpdef.h
字号:
/******************************************************************************
Copyright(C) 2005,2006 Frank ZHANG
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA.
******************************************************************************
* Authors : Frank ZHANG (openmgcp@gmail.com)
* Description : MGCP message sturcture definition.
*
*
* Date of creation : 08/23/2005
*
*
* History :
* 2005/08/23 Frank ZHANG : - Creation
******************************************************************************/
#ifndef __MGCP_DEF_H__
#define __MGCP_DEF_H__
#include "posix.h"
#include "typedef.h"
#include "list.h"
#include "mgcppackage.h"
#ifdef __cplusplus
extern "C" {#endif
/******************************************************************************
* Response code category
******************************************************************************/
/* Response acknowledgement */
#define RSP_ACK_MIN 0
#define RSP_ACK_MAX 99
/* Provisional response */
#define RSP_PROVISIONAL_MIN 100
#define RSP_PROVISIONAL_MAX 199
/* Successful completion of command */
#define RSP_SUCCEED_MIN 200
#define RSP_SUCCEED_MAX 299
/* transient error */
#define RSP_TRANS_ERROR_MIN 400
#define RSP_TRANS_ERROR_MAX 499
/* permanent error */
#define RSP_PERMA_ERROR_MIN 500
#define RSP_PERMA_ERROR_MAX 599
#define RSP_TRANSACTION_IN_PROGRESS 100
#define RSP_TRANSACTION_QUEUED 101
#define RSP_TRANSACTION_SUCCEED 200
#define RSP_CONNECTION_DELETED 250
#define RSP_UNSPECIFIED_TRANSIENT_ERROR 400
#define RSP_PHONE_OFF_HOOK 401
#define RSP_PHONE_ON_HOOK 402
#define RSP_INSUFFICIENT_RESOURCES 403
#define RSP_INSUFFICIENT_BANDWIDTH 404
#define RSP_ENDPOINT_IS_RESTARTING 405
#define RSP_TRANSACTION_TIMEOUT 406
#define RSP_TRANSACTION_ABORTED 407
#define RSP_INTERNAL_OVERLOAD 409
#define RSP_ENDPOINT_UNAVAILABLE 410
#define RSP_ENDPOINT_UNKNOWN 500
#define RSP_ENDPOINT_OUT_OF_SERVICE 501
#define RSP_INSUFFICIENT_RESOURCES_PERMANENT 502
#define RSP_WILDCARD_TOO_COMPLICATED 503
#define RSP_UNSUPPORTED_COMMAND 504
#define RSP_UNSUPPORTED_CONNEC_DESCRIPTOR 505
#define RSP_UNSATISFIED_CONNECTION_OPTION 506
#define RSP_UNSUPPORTED_FUNCTIONALITY 507
#define RSP_UNSUPPORTED_QUARANTINE_HANDLING 508
#define RSP_ERROR_REMOTECONNECDESCRIPTOR 509
#define RSP_PROTOCOL_ERROR 510
#define RSP_UNRECOGNIZED_PARAMETER_EXTENSION 511
#define RSP_UNEQUIPPED_DETECT_EVENTS 512
#define RSP_UNEQUIPPED_GENERATE_SIGNALS 513
#define RSP_UNSUPPORTED_ANNOUNCEMENT 514
#define RSP_INCORRECT_CONNECTION_ID 515
#define RSP_UNKNOWN_CALL_ID 516
#define RSP_INVALID_MODE 517
#define RSP_UNSUPPORTED_PACKAGE 518
#define RSP_DIGIT_MAP_IS_NULL 519
#define RSP_REDIRECT_CA 521
#define RSP_NO_SUCH_EVENT_SIGNAL 522
#define RSP_UNKNOWN_OR_ILLEGAL_COMBIN_ACTIONS 523
#define RSP_INCONSISTENCY_LOCAL_CONNEC_OPTIONS 524
#define RSP_UNKNOWN_CONNEC_OPTIONS_EXTENSION 525
#define RSP_INSUFFICIENT_BANDWIDTH_PERMANENT 526
#define RSP_MISSING_REMOTE_CONNEC_DESCRIPTOR 527
#define RSP_INCOMPATIBLE_PROTOCOL_VERSION 528
#define RSP_INTERNAL_HARDWARE_ERROR 529
#define RSP_CAS_SIGNALING_ERROR 530
#define RSP_FAILURE_GROUPING_TRUNKS 531
#define RSP_UNSUPPORTED_LOCAL_CONNEC_OPT_VALUE 532
#define RSP_RESPONSE_TOO_LARGE 533
#define RSP_CODEC_NEGOTIATION_FAILURE 534
#define RSP_UNSUPPORTED_PACKETIZATION_PERIOD 535
#define RSP_UNKNOWN_RESTART_METHOD 536
#define RSP_UNKNOWN_DIGIT_MAP_EXTENSION 537
#define RSP_EVENT_SIGNAL_PARAMETER_ERROR 538
#define RSP_UNSUPPORTED_COMMAND_PARAMETER 539
#define RSP_REACH_ENDPOINT_CONNECTION_LIMIT 540
#define RSP_UNSUPPORTED_LOCAL_CONNEC_OPTIONS 541
/* Max size of MGCP datagram in bytes that can be received by the endpoint,
MGCP mandates that implementations MUST support MGCP datagrams up to at
least 4000 bytes */
#define MAX_MGCP_DATAGRAM 4000
#define MGCP_CRCX_CMD_MAN_NUMBER 2 /* CRCX command mandaroty parameter number */
#define MGCP_MDCX_CMD_MAN_NUMBER 2 /* MDCX command mandaroty parameter number */
#define MGCP_RQNT_CMD_MAN_NUMBER 1 /* RQNF command mandaroty parameter number */
#define MGCP_NTFY_CMD_MAN_NUMBER 2 /* NTFY command mandaroty parameter number */
#define MGCP_AUCX_CMD_MAN_NUMBER 2 /* AUCX command mandaroty parameter number */
#define MGCP_RSTP_CMD_MAN_NUMBER 1 /* RSIP command mandaroty parameter number */
/******************************************************************************
* SDP structure and function definition
******************************************************************************/
/* Multicast address structure */
typedef struct
{
char *pcIPv4address;
char *pcTTL;
char *pcInteger;
} MULTICAST_ADDRESS;
typedef enum
{
ADDRESS_MULTICAST = 1, /* Multicast address */
ADDRESS_IPV4,
ADDRESS_IPV6,
ADDRESS_FQDN
} E_ADDRESS_TYPE;
/* Connection address structure */
typedef struct
{
E_ADDRESS_TYPE eType;
char *pcAddress;
} CONNECTION_ADDRESS;
/* Connection field structure */
typedef struct
{
char *pcNetType; /* Network type */
char *pcAddrType; /* Address type */
CONNECTION_ADDRESS ConnectionAddress; /* Address of the connection */
} CONNECTION_FIELD;
typedef enum
{
MEDIA_PROTOCOL_RTP = 1,
MEDIA_PROTOCOL_UDP,
MEDIA_PROTOCOL_OTHER
} E_MEDIA_PROTOCOL;
/* Media protocol structure */
typedef struct
{
E_MEDIA_PROTOCOL eType;
char *pcOtherProtocol;
} MEDIA_PROTOCOL;
/* Media field structure */
typedef struct
{
char *pcMedia; /* Media name, such as "audio","video","data" */
char *pcPort; /* Media port, should in the range "1024" to "65535"
* inclusive for UDP based media */
char *pcInteger;
MEDIA_PROTOCOL Protocol; /* Media protocol type, such as "RTP","UDP" */
WORD wNum;
char **ppcFormat; /* typically an RTP payload type for audio and video media */
} MEDIA_FIELD;
/* Attribue field structure */
typedef struct
{
char *pcAttibuteName;
char *pcAttibuteValue;
} ATTRIBUTE_FIELD;
/* Media description structure */
typedef struct
{
MEDIA_FIELD MediaField;
WORD wNum;
ATTRIBUTE_FIELD *pAttributeFields;
} MEDIA_DESCRIPTIONS;
/* SDP structure */
typedef struct
{
CONNECTION_FIELD *pConnectionField;
WORD wAttributeNum;
ATTRIBUTE_FIELD *pAttributeFields;
WORD wMediaNum;
MEDIA_DESCRIPTIONS *pMediaDesc;
} SDP_ANNOUNCEMENT, CONNECTION_DESCRIPTOR;
/*****************************************************************************
* MGCP parameter lines defination *
*****************************************************************************/
typedef struct
{
DWORD dwTranIDStart;
DWORD dwTranIDEnd;
} TRANSACTION_ID_RANGE;
typedef struct
{
WORD wNum;
TRANSACTION_ID_RANGE *pTranIdRange;
} RESPONSE_ACK;
typedef enum
{
BEARER_ENCODE_A_LAW = 1,
BEARER_ENCODE_U_LAW,
BEARER_ENCODE_EXTENSION
} E_BEARER;
typedef struct
{
char *pcExtenPackageName;
char *pcBearerExtenName;
char *pcBearerExtenValue;
} BEARER_EXTENSION;
typedef struct
{
E_BEARER eBearerEncodingType;
BEARER_EXTENSION pBearerExtension;
} BEARER_ATTRIBUTE;
typedef struct
{
WORD wNum;
BEARER_ATTRIBUTE *pBearerAttributes;
} BEARER_INFO;
typedef struct
{
WORD wNum;
char **ppcConnectionIDList;
} CONNECTION_IDS;
typedef enum
{
NE_IP_ADDRESS = 1, /* The domain name is dot-decimal address foramat */
NE_STRING, /* The domain name is string */
NE_EMPTY /* The NE is empty value */
} E_NE_TYPE;
#define MAX_IP_ADDRESS 5
typedef struct
{
char *pcLocalName; /* Local name part, maybe NULL */
char *pcDomainName; /* Domain name part */
WORD wPort; /* UDP port number */
/* Only useful when send commands, to indicate the
* destination address of the command */
WORD wAddrNum;
WORD wCurAddrIndex;
DWORD pIPAddrList[MAX_IP_ADDRESS];
} NOTIFIED_ENTITY;
typedef struct
{
WORD wMinValue;
WORD wMaxValue;
} PACKETIZATION_PERIOD;
typedef struct
{
WORD wNum;
char **ppcAlgorithmList;
} COMPRESSION_ALGORITHM;
typedef struct
{
WORD wMinValue;
WORD wMaxValue;
} BANDWIDTH;
typedef enum
{
OO_UNDEFINED,
OO_ON,
OO_OFF
} E_ON_OFF;
typedef enum
{
RSVP_UNDEFINED,
RSVP_CONTROLLED_LOAD,
RSVP_GUARANTEED_SERVICE,
RSVP_BEST_EFFORT
} E_RESOURCE_RESERVATION;
typedef enum
{
NETWOR_UNDEFINED,
NETWOR_INTERNET,
NETWOR_ATM,
NETWOR_LOCAL
} E_NETWOR_TYPE;
typedef enum
{
ENCRY_CLEAR = 1,
ENCRY_BASE64,
ENCRY_URI,
ENCRY_PROMPT
} E_ENCRY_TYPE;
typedef struct
{
E_ENCRY_TYPE eType;
char *pEncryKey;
} ENCRYPTION_DATA;
typedef enum
{
LOCAL_EXT_VENDOR_MAN = 1,
LOCAL_EXT_VENDOR_OPT,
LOCAL_EXT_PACKAGE,
LOCAL_EXT_OTHER
} E_LOCAL_EXTENSION;
typedef struct
{
E_LOCAL_EXTENSION eType;
char *pcPackageName;
char *pcExtensionName;
char *pcExtensionValue;
} LOCAL_OPTION_EXTENSION;
#define AUTO_GAIN_CONTROL 0x7FFF
typedef struct
{
WORD wOptNum; /* The valid option numbers in this structure */
PACKETIZATION_PERIOD *pPacketizationPeriod;
COMPRESSION_ALGORITHM *pCompressAlgo;
BANDWIDTH *pBandwidthValue;
SHORT *psGainControl;
E_ON_OFF *peEchocancellation;
E_ON_OFF *peSilenceSuppression;
BYTE *pucTypeOfService;
E_RESOURCE_RESERVATION *peResourceReservation;
E_NETWOR_TYPE *peTypeOfNetwork;
ENCRYPTION_DATA *pEncryData;
LOCAL_OPTION_EXTENSION *pLocalOptExtension;
} LOCAL_CONNEC_OPTS;
typedef enum
{
CONNECTION_MODE_SENDONLY = 1,
CONNECTION_MODE_RECEIVEONLY,
CONNECTION_MODE_SENDRECEIVE,
CONNECTION_MODE_CONFERENCE,
CONNECTION_MODE_INACTIVE,
CONNECTION_MODE_LOOPBACK,
CONNECTION_MODE_CONTINUITY,
CONNECTION_MODE_NET_CONTINUITY,
CONNECTION_MODE_NET_LOOP,
CONNECTION_MODE_EXTENSION_MODE
} E_CONNECTION_MODE;
typedef struct
{
char *pcExtenPackageName;
char *pcExtenModeName;
} EXTENSION_CONNECTION_MODE;
typedef struct
{
E_CONNECTION_MODE eMode;
EXTENSION_CONNECTION_MODE *pExtenMode;
} CONNECTION_MODE;
typedef enum
{
EVENT_ID = 1, /* EventId */
EVENT_ALL, /* "All" */
EVENT_DTMF_ASTERISK, /* "*" */
EVENT_DTMF_POUND, /* "#" */
EVENT_RANGE /* [abcd-1234567890] */
} E_EVENT_ID;
typedef struct
{
char *pcPackageName; /* "*" = any package */
E_EVENT_ID eType;
char *pcEventIDName;
char *pcConnectionId; /* "$" = Any; "*" = All */
} EVENT_NAME;
typedef struct
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -