?? h323parser.cpp
字號:
/* * H323Parser.cpp * * Copyright (c) 2001 Institute for Information Industry, Taiwan, Republic of China * (http://www.iii.org.tw/iiia/ewelcome.htm) * * 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 1, or (at your option) * any later version. * * 2001/07/27 Huang-Ming Huang * Fixed the problem which the parser mistakes the Q.931 message for H.245 message. */#define H323_MESSAGES_CXX#define MULTIMEDIA_SYSTEM_CONTROL_CXX#include "h323_messages.h"#include "multimedia_system_control.h"#include "call_transfer_operations.h"#include "call_diversion_operations.h"#include "call_hold_operations.h"#include "call_park_pickup_operations.h"#include "call_waiting_operations.h"#include "message_waiting_indication_operations.h"#include "name_operations.h"#include "call_completion_operations.h"#include "call_offer_operations.h"#include "q931pdu.h"#include "perattacher.h"#include <netmon.h>// Globals -------------------------------------------------------------------HPROTOCOL hRAS = NULL;HPROTOCOL hTPKT = NULL;HPROTOCOL hQ931 = NULL;HPROTOCOL hH245 = NULL;DWORD Attached = 0;// Functions -----------------------------------------------------------------extern VOID WINAPI H323_Deregister( HPROTOCOL hRAS);extern DWORD WINAPI H323_FormatProperties( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD nPropertyInsts, LPPROPERTYINST p);VOID WINAPIV Custom_Format( LPPROPERTYINST pPropertyInst);extern VOID WINAPI RAS_Register( HPROTOCOL hRAS);extern LPBYTE WINAPI RAS_RecognizeFrame( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, LPDWORD pProtocolStatus, LPHPROTOCOL phNextProtocol, LPDWORD InstData);extern LPBYTE WINAPI RAS_AttachProperties( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, DWORD InstData);extern VOID WINAPI TPKT_Register( HPROTOCOL hTPKT);extern LPBYTE WINAPI TPKT_RecognizeFrame( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, LPDWORD pProtocolStatus, LPHPROTOCOL phNextProtocol, LPDWORD InstData);extern LPBYTE WINAPI TPKT_AttachProperties( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, DWORD InstData);extern VOID WINAPI H245_Register( HPROTOCOL hTPKT);extern LPBYTE WINAPI H245_RecognizeFrame( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, LPDWORD pProtocolStatus, LPHPROTOCOL phNextProtocol, LPDWORD InstData);extern LPBYTE WINAPI H245_AttachProperties( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, DWORD InstData);extern VOID WINAPI Q931_Register( HPROTOCOL hTPKT);extern LPBYTE WINAPI Q931_RecognizeFrame( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, LPDWORD pProtocolStatus, LPHPROTOCOL phNextProtocol, LPDWORD InstData);extern LPBYTE WINAPI Q931_AttachProperties( HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pH323Frame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, DWORD InstData);// Define the entry points that we will pass back at dll entry time ----------ENTRYPOINTS RASEntryPoints ={ // RAS Entry Point RAS_Register, H323_Deregister, RAS_RecognizeFrame, RAS_AttachProperties, H323_FormatProperties};ENTRYPOINTS TPKTEntryPoints ={ // TPKT Entry Point TPKT_Register, H323_Deregister, TPKT_RecognizeFrame, TPKT_AttachProperties, H323_FormatProperties};ENTRYPOINTS H245EntryPoints ={ // H245 Entry Point H245_Register, H323_Deregister, H245_RecognizeFrame, H245_AttachProperties, H323_FormatProperties};ENTRYPOINTS Q931EntryPoints ={ // H245 Entry Point Q931_Register, H323_Deregister, Q931_RecognizeFrame, Q931_AttachProperties, H323_FormatProperties};PROPERTYINFO RasPropertyInfo = { 0, 0, "", "", PROP_TYPE_SUMMARY, PROP_QUAL_NONE, NULL, 160, &Custom_Format};PROPERTYINFO TpktPropertyInfo = { 0, 0, "", "", PROP_TYPE_SUMMARY, PROP_QUAL_NONE, NULL, 80, &Custom_Format};PROPERTYINFO H245PropertyInfo = { 0, 0, "", "", PROP_TYPE_SUMMARY, PROP_QUAL_NONE, NULL, 160, &Custom_Format};PROPERTYINFO Q931PropertyInfo = { 0, 0, "", "", PROP_TYPE_SUMMARY, PROP_QUAL_NONE, NULL, 160, &Custom_Format};char* RAS_String[] = { "GRQ", "GCF", "GRJ", "RRQ", "RCF", "RRJ", "URQ", "UCF", "URJ", "ARQ", "ACF", "ARJ", "BRQ", "BCF", "BRJ", "DRQ", "DCF", "DRJ", "LRQ", "LCF", "LRJ", "IRQ", "IRR", "Non-Standard Message", "Unknown Message Response", "RIP", "RAI", "RAC", "IACK", "INAK"};BOOL RAS_AutoInstall(PPF_PARSERINFO pParserInfo){ DWORD NumHandoffs; PPF_HANDOFFSET pHandoffSet; PPF_HANDOFFENTRY pHandoffEntry; wsprintf( pParserInfo->szProtocolName, "RAS" ); wsprintf( pParserInfo->szComment, "H.323 RAS Protocol" ); wsprintf( pParserInfo->szHelpFile, ""); // the incoming handoff set ---------------------------------------------- // allocate NumHandoffs = 2; pHandoffSet = (PPF_HANDOFFSET)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( PF_HANDOFFSET ) + NumHandoffs * sizeof( PF_HANDOFFENTRY) ); if( pHandoffSet == NULL ) { // just return early return FALSE; } // fill in the incoming handoff set pParserInfo->pWhoHandsOffToMe = pHandoffSet; pHandoffSet->nEntries = NumHandoffs; // UDP PORT 1719 pHandoffEntry = &(pHandoffSet->Entry[0]); wsprintf( pHandoffEntry->szIniFile, "TCPIP.INI" ); wsprintf( pHandoffEntry->szIniSection, "UDP_HandoffSet" ); wsprintf( pHandoffEntry->szProtocol, "RAS" ); pHandoffEntry->dwHandOffValue = 1718; pHandoffEntry->ValueFormatBase = HANDOFF_VALUE_FORMAT_BASE_DECIMAL; // UDP PORT 1719 pHandoffEntry = &(pHandoffSet->Entry[1]); wsprintf( pHandoffEntry->szIniFile, "TCPIP.INI" ); wsprintf( pHandoffEntry->szIniSection, "UDP_HandoffSet" ); wsprintf( pHandoffEntry->szProtocol, "RAS" ); pHandoffEntry->dwHandOffValue = 1719; pHandoffEntry->ValueFormatBase = HANDOFF_VALUE_FORMAT_BASE_DECIMAL; return TRUE;}BOOL H245_AutoInstall(PPF_PARSERINFO pParserInfo){ DWORD NumHandoffs; PPF_HANDOFFSET pHandoffSet; PPF_HANDOFFENTRY pHandoffEntry; DWORD NumFollows; PPF_FOLLOWSET pFollowSet; PPF_FOLLOWENTRY pFollowEntry; wsprintf( pParserInfo->szProtocolName, "H.245" ); wsprintf( pParserInfo->szComment, "H.245 Protocol" ); wsprintf( pParserInfo->szHelpFile, ""); // the incoming follow set ----------------------------------------------- // allocate NumFollows = 2; pFollowSet = (PPF_FOLLOWSET)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( PF_FOLLOWSET ) + NumFollows * sizeof( PF_FOLLOWENTRY) ); if( pFollowSet == NULL ) { // just return early return FALSE; } // fill in the incoming follow set pParserInfo->pWhoCanPrecedeMe = pFollowSet; pFollowSet->nEntries = NumFollows; // TCP pFollowEntry = &(pFollowSet->Entry[0]); wsprintf( pFollowEntry->szProtocol, "TCP" ); // TPKT pFollowEntry = &(pFollowSet->Entry[1]); wsprintf( pFollowEntry->szProtocol, "TPKT" ); // the outgoing HandOff set ----------------------------------------------- // allocate NumHandoffs = 1; pHandoffSet = (PPF_HANDOFFSET) HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( PF_HANDOFFSET ) + NumHandoffs * sizeof( PF_HANDOFFENTRY) ); if( pHandoffSet == NULL ) { // just return early return FALSE; } // fill in outgoing HandOff set pParserInfo->pWhoDoIHandOffTo = pHandoffSet; pFollowSet->nEntries = NumHandoffs; // TPKT pHandoffEntry = &(pHandoffSet->Entry[0]); wsprintf( pHandoffEntry->szProtocol, "TPKT" ); return TRUE;}BOOL Q931_AutoInstall(PPF_PARSERINFO pParserInfo){ DWORD NumHandoffs; PPF_HANDOFFSET pHandoffSet; PPF_HANDOFFENTRY pHandoffEntry; DWORD NumFollows; PPF_FOLLOWSET pFollowSet; PPF_FOLLOWENTRY pFollowEntry; wsprintf( pParserInfo->szProtocolName, "Q.931" ); wsprintf( pParserInfo->szComment, "Q.931 Protocol" ); wsprintf( pParserInfo->szHelpFile, ""); // the incoming follow set ----------------------------------------------- // allocate NumFollows = 2; pFollowSet = (PPF_FOLLOWSET)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( PF_FOLLOWSET ) + NumFollows * sizeof( PF_FOLLOWENTRY) ); if( pFollowSet == NULL ) { // just return early return FALSE; } // fill in the incoming follow set pParserInfo->pWhoCanPrecedeMe = pFollowSet; pFollowSet->nEntries = NumFollows; // TCP pFollowEntry = &(pFollowSet->Entry[0]);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -