📄 event.hpp
字号:
/* ======================================================================== *\ | | | JOYIT Communication Technology | Copyright (C) 2002-2003, All Right Reserved. | | System: Programmable Signaling Gateway | Sub-system: PSG | Filename: event.hpp | Environment: LINUX -- Red Hat 9.0 & GNU C/C++ Compiler 3.2.2 | vxWorks -- Tornado 2.0 & vxWorks 5.4 | Function description: Declare all the event. | |\* ======================================================================== */#ifndef _EVENT_HPP#define _EVENT_HPP#ifndef _DATATYPE_HPP#include "datatype.hpp"#endif#ifdef __cplusplusextern "C"{#endif//#ifdef __LINUX__#ifndef _TIME_H#include <time.h>#endif#ifndef _STRING_H#include <string.h>#endif#elif __VXWORKS__#ifndef __INCtimeh#include <time.h>#endif#ifndef __INCstringh#include <string.h>#endif#endif#ifdef __cplusplus};//#endiftypedef unsigned short ObjectID; // type of object identifiertypedef unsigned long ModuleID; // type of module identifiertypedef unsigned long ProcessID;// type of process identifierconst UINT32 evNothing = 0x00000000L, evKeyboard = 0x00000001L, evMouse = 0x00000002L, evTimer = 0x00000004L, evNetwork = 0x00000008L, evSerial = 0x00000010L, evPrint = 0x00000020L, evSS7 = 0x00000040L, evOAM = 0x00000080L, evLAPD = 0x00000100L, evRawSignal = 0x00001000L, // Adding for SAP project. 2007-07-26 evBroadcast = 0x80000000L;# pragma pack(1) //2003-09-19,Lushengshengstruct KeyboardEvent{ union { ushort keyCode; struct { uchar charCode; uchar scanCode; } charScan; };};struct BroadcastEvent{ ModuleID src;};struct LapdEvent{ UINT8 stackId; UINT16 linkId; UINT16 brd; //PCM ID UINT8 chn; //Time Slot};struct PrintEvent{ time_t timeStamp; // store this message what time is created. uchar printStyle; // Which style to be use when display this message.};struct TimerEvent{ union { ushort module; ushort brd; ushort cgId; }; union { ushort subMod; uchar chn; };};struct NetworkEvent{ union { ushort ci; // Channel identifier ushort pn; // Port number };};struct OamEvent{ union { UINT16 linkid; UINT16 linksetid; UINT16 tracecmd; UINT16 alarmcmd; }; union { struct { UINT16 brd; UINT8 chn; }pcm; struct { UINT32 dpc; UINT16 cic; }ss7; }; UINT16 routesetid; UINT8 stackid; UINT16 cnt; UINT32 tm; UINT32 stat;};struct CCS7Event{ union { ushort stackId; ushort linkId; // Link id. struct { uchar psbId; uchar sccIdx; }psb; }; union { // to identify CCS7 object. ushort cgId; // Circuit group id. struct { ushort brd; uchar chn; } ts; struct { union { ushort linkSetId; // Link set id. ushort spId; // Point code id. }; union { ushort status; // It can indicate any status. uchar routeIndex; // Route index in SignalingPoint::route uchar upid; // SS7 MTP3 user part id ushort bsnt; ushort fsnc; }; } data; };};// ### The following lines are added for SAP project. 2007-07-26struct RawSignalEvent{ uint dwSerialNum; // 信令流水号 UINT16 usLinkId; // 链路号 uchar ucBW; // MSU路由标记类型64K/2M};// ### End 2007-07-26struct WEvent{ // @@@ Add packet head here. UINT8 PtlId; // Protocol ID = PTL_SS7 UINT8 PtlVer; // Protocol Version UINT16 PktLength; // Packet Length ModuleID dmid; // Global destination module id. ModuleID smid; // Global original module id. UINT8 Reserved; // Reserved byte. UINT8 Priority; // Priority of packet. // @@@ End head. UINT32 what; // ModuleID dmid;// Used between process. // ModuleID smid;// Used between process. ObjectID dst; // Used inner process. ObjectID src; // Used inner process. ushort evCode; union { BroadcastEvent bcEvent;//Broacast OamEvent oamEvent; KeyboardEvent kbEvent; // Event of keyboard (key was stroked by operator). PrintEvent prEvent; // Event to display on monitor. TimerEvent tmEvent; // Event of timer. NetworkEvent nwEvent; // Event from Network. LapdEvent lpEvent; // LAPD CCS7Event s7Event; // Event of ccs7. (Inner event of signaling stack) RawSignalEvent stRawSignalEvnet; // Adding for SAP project. }; ushort msgLen; char * msgPtr; // Modify type of msgPtr, from UINT8 to char. WEvent * next; // Pointer to the next event instance. WEvent( ) { memset(this, 0, sizeof(WEvent)); } void del( ) { // Delete this event's message pointer. if(msgPtr && msgLen>0) { // Modify 2005-01-06, by Wujianjin. // delete msgPtr; delete[] msgPtr; } memset(this,0,sizeof(WEvent)); };};# pragma pack() //2003-09-19,Lushengshengconst short MAXEVENT = 30000; // #define MAXEVENT 1024 // Let it configurable. //8192const UINT16 EV_QINSERT = 0, // Event inserted successful. EV_NULL = 1, // The event is null. EV_QFULL = 2, // Event queue is full, couldn't insert event more. EV_OUTMEM = 3; // Out of memory.class EventQueueType{public: EventQueueType( ); // { head = NULL; tail = NULL; evCount = 0; capacity = MAXEVENT; } EventQueueType(short cap); ~EventQueueType( ); void Clear( );private: inline void P_ev( ) { evCount ++; } inline void V_ev( ) { evCount --; }public: short getEventCount( ) { return evCount; }; short getCapacity( ); void setCapacity(short cap); int evtCount(){return evCount;};public: char insertEvent(const WEvent& event); // Insert one event into head of the queue. char pushEvent(const WEvent& event); // Push one event into the queue, it will // append on tail. void popEvent(WEvent& event); // Pop one event from head of the queue.private: WEvent * head, * tail; short evCount; short capacity;};extern EventQueueType systemEventQueue;#endif// ------------------------------------------------------------------------//// Revision list.// ==============//// 1.0, 2003-04-18, Wu jianjin// Initial version.// 1.1, 2003-05-19, Wu jianjin// Ported to vxWorks.// 1.2, 2003-06-09, Wu jianjin// Change type of event::msgPtr, from UINT8 to char.//// 1.3 2003-09-19,Lushengsheng// add "#pragma pack()"// ------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -