From 3f340f4335dd3e69ae9d82aa786fe9b8616e70dc Mon Sep 17 00:00:00 2001 From: Helmut Kuper Date: Sat, 31 Jan 2009 10:23:23 +0000 Subject: [PATCH] Q931ToPcap: Changed predefined ethernet frames in writeQ931... function from local to global variables. This should speed things up a bit. git-svn-id: http://svn.openzap.org/svn/openzap/trunk@631 a93c3328-9c30-0410-af19-c9cd2b2d52af --- .../openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c index 8d512f5394..be3d86313f 100644 --- a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c +++ b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c @@ -78,7 +78,29 @@ pcap_t *pcaphandle = NULL; char *pcapfn = NULL; int do_q931ToPcap= 0; +/*Predefined Ethernet Frame with Q931-over-IP encapsulated - From remote TDM host to FreeSWITCH*/ +L3UCHAR recFrame[SNAPLEN]= { + /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ + 2,0,1,0xAA,0xAA,0xAA,2,0,1,0xBB,0xBB,0xBB,0x81,0,0xE0,0,0x08,0, + /*IPv4 Header (minimal size; no options)*/ + 0x45,0,0,44,0,0,0,0,64,6,0,0,2,2,2,2,1,1,1,1, + /*TCP-Header*/ + 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, + /*TPKT-Header RFC 1006*/ + 3,0,0,0 + }; +/*Predefined Ethernet Frame with Q931-over-IP encapsulated - Frome FreeSWITCH to remote TDM host*/ +L3UCHAR sendFrame[SNAPLEN]= { + /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ + 2,0,1,0xBB,0xBB,0xBB,2,0,1,0xAA,0xAA,0xAA,0x81,0,0xE0,0,0x08,0, + /*IPv4 Header (minimal size; no options)*/ + 0x45,0,0,44,0,0,0,0,64,6,0,0,1,1,1,1,2,2,2,2, + /*TCP-Header*/ + 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, + /*TPKT-Header RFC 1006*/ + 3,0,0,0 + }; static zap_status_t openPcapFile(void) { @@ -144,29 +166,6 @@ static zap_status_t writeQ931PacketToPcap(L3UCHAR* q931buf, L3USHORT q931size, L spanid=span_id; - /*Predefined Ethernet Frame with Q931-over-IP encapsulated - From remote TDM host to FreeSWITCH*/ - L3UCHAR recFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xAA,0xAA,0xAA,2,0,1,0xBB,0xBB,0xBB,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,2,2,2,2,1,1,1,1, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; - - /*Predefined Ethernet Frame with Q931-over-IP encapsulated - Frome FreeSWITCH to remote TDM host*/ - L3UCHAR sendFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xBB,0xBB,0xBB,2,0,1,0xAA,0xAA,0xAA,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,1,1,1,1,2,2,2,2, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; /*The total length of the ethernet frame generated by this function has a min length of 66 so we don't have to care about padding :)*/