📄 ptlbase.hpp
字号:
/* ======================================================================== *\ | | | JOYIT Communication Technology | Copyright (C) 2003 -2005, All Right Reserved. | | System: JOYIT Platform | Sub-system: | Filename: ptlbase.cpp | Environment: Red Hat Linux 7.2 & GNU C/C++ Compiler 2.96 | Function description: Protocol base class |\* ======================================================================== */#ifndef _PTLBASE_HPP#define _PTLBASE_HPPextern "C"{#ifndef _STDIO_H#include <stdio.h>#endif #ifndef _STRING_H#include <string.h>#endif};#define MAX_PTL 16 // Maximum protocol type allowed.#define MAX_IE 256 // Maximum IEs allowed. The permited rang is 0~254.#define MAX_MSG 255#define IE_NOT_EXIST 255 // #define MAX_MSGLEN 512 // Maximum message length in octecs allowed.#define MAX_HEADER_LENGTH 64 // Maximum octets that PDU's header allowed.//// Declare supported protocol type.//// Joyit API, modify 2005-10-30, by Wujianjin.#define MOD_JOYIT 0x00 // Form of PDU in JOYIT inner style.#define MOD_MTPAPI PTL_MTPAPI#define MOD_TUPAPI PTL_TUPAPI#define MOD_ISUPAPI PTL_ISUPAPI#define MOD_SCCPAPI PTL_SCCPAPI#define MOD_MAPAPI PTL_MAPAPI#define MOD_INAPAPI PTL_INAPAPI#define MOD_Q931API PTL_Q931API#define MOD_M2PAPI 0x30 // 0x91#define MOD_M2UAPI 0x31 // 0x92#define MOD_M3UAPI 0x32 // 0x93#define MOD_SUAPI 0x33 // 0x94#define MOD_TUAPI 0x34 // 0x95#define MOD_IUAPI 0x35 // 0x96#define MOD_GSMA_BSSMAP 0x36#define MOD_GSMA_DTAP 0x37// Signaling/Protocol, modify 2005-10-30, by Wujianjin.#define MOD_MTP MOD_MTPAPI+0x80#define MOD_TUP MOD_TUPAPI+0x80#define MOD_ISUP MOD_ISUPAPI+0x80#define MOD_SCCP MOD_SCCPAPI+0x80#define MOD_MAP MOD_MAPAPI+0x80#define MOD_INAP MOD_INAPAPI+0x80#define MOD_Q931 MOD_Q931API+0x80#define MOD_M2PA MOD_M2PAPI+0x80#define MOD_M2UA MOD_M2UAPI+0x80#define MOD_M3UA MOD_M3UAPI+0x80#define MOD_SUA MOD_SUAPI+0x80#define MOD_TUA MOD_TUAPI+0x80#define MOD_IUA MOD_IUAPI+0x80#define INDICATION_PRIMITIVE 0 // Add 2005-11-19, by Wu jianjin.#define REQUEST_PRIMITIVE 1 // Add 2005-11-19, by Wu jianjin.//// Declare variant///* * Declare Signaling Variant macro. */#define SV_CHINA_VARIANT 0x00 // CHINA variant, include all CHINA version.#define SV_CHINA_MTP2 0x01#define SV_CHINA_MTP3 0x02#define SV_CHINA_TUP 0x03#define SV_CHINA_ISUP 0x04#define SV_CHINA_SCCP 0x05#define SV_CHINA_TCAP 0x06#define SV_CHINA_MAP 0x07#define SV_CHINA_CAP 0x08#define SV_CHINA_INAP 0x09#define SV_CHINA_WIN 0x0A#define SV_ITU_VARIANT 0x10 // ITU variant, defualt implict indicate white book.#define SV_ITU_MTP2 0x11#define SV_ITU_MTP3 0x12#define SV_ITU_TUP 0x13#define SV_ITU_ISUP 0x14#define SV_ITU_SCCP 0x15#define SV_ITU_TCAP 0x16#define SV_ITU_INAP 0x19#define SV_ETSI_VARIANT 0x20 // ETSI variant, include all ETSI version.#define SV_ETSI_MTP2 0x21#define SV_ETSI_MTP3 0x22#define SV_ETSI_TUP 0x23#define SV_ETSI_ISUP 0x24#define SV_ETSI_SCCP 0x25#define SV_ETSI_TCAP 0x26#define SV_ETSI_MAP 0x27#define SV_ETSI_CAP 0x28#define SV_ETSI_INAP 0x29#define SV_ANSI_VARIANT 0x30 // ANSI variant, include all ANSI version.#define SV_ANSI_MTP2 0x31#define SV_ANSI_MTP3 0x32#define SV_ANSI_TUP 0x33#define SV_ANSI_ISUP 0x34#define SV_ANSI_SCCP 0x35#define SV_ANSI_TCAP 0x36#define SV_ANSI_MAP 0x37#define SV_ANSI_INAP 0x38#define SV_ANSI_WIN 0x39typedef unsigned char UINT8; typedef unsigned short UINT16;typedef unsigned long UINT32;#define SIZE_OF_POINTER sizeof(UINT32)// sizeof(char *)// IE structclass CIeBase{public: UINT8 id; // Primary key UINT16 len; // Length of IE(data) not include id and len union { char * ptr; // Pointer point to IE's content when length of IE data longer than 4 bytes. UINT32 data; // Store IE's value when length of IE data shorter than 4 bytes. };public: CIeBase( ); ~CIeBase( ); void Init( );};class CPduBase{public: CPduBase();public: virtual void Init( ); // Initialize the PDU.public: int PutIE(UINT8 id, UINT16 len, unsigned char * ptr);// Put IE into PDU. CIeBase * GetIE(UINT8 id, UINT8 seq=0); // Delete IE from PDU. SEQ indicate sequence of repeated IE to be deleted.public:private:public: CIeBase IE[MAX_IE]; // Store all IE information.};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -