110 lines
3.0 KiB
C++

//----------------------------------------------------------------------------
//
// Copyright (C) Intel Corporation, 2006 - 2007.
//
// File: TunnelSupplier.h
//
// Contents: Handles incoming data on APF tunnel.
//
// Notes:
//----------------------------------------------------------------------------
#ifndef AMT_TUNNEL_SUPPLIER
#define AMT_TUNNEL_SUPPLIER
#include <ace/ACE.h>
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include <ace/Message_Block.h>
#include <ace/SOCK_Stream.h>
#include <ace/Recursive_Thread_Mutex.h>
#include "global.h"
#include "soapStub.h"
// FW declaration
class Channel_Manager;
class AMT_Tunnel_Handler;
class AMT_Tunnel_Consumer;
// ============================================================================
// = TITLE
// Handles reception of APF packet from Intel(R) AMT.
//
// = DESCRIPTION
// Performs parsing on APF messages and act accordingly. Intended to
// run reactively, i.e., in one thread of control using a
// Reactor for demuxing and dispatching.
// ============================================================================
class AMT_Tunnel_Supplier
{
friend class AMT_Tunnel_Handler;
public:
// = Initialization method.
AMT_Tunnel_Supplier (AMT_Tunnel_Handler *tunnel_handler);
// = Destruction
virtual ~AMT_Tunnel_Supplier(void);
// = Set/get the current tunnel state.
void tunnelState (int state);
int tunnelState (void) const;
// Close this supplier
STATUS handle_close();
// Receive and process an APF message from the socket.
virtual STATUS handle_input ();
ACE_SOCK_Stream& getPeer(void) const;
AMT_Tunnel_Consumer* consumer() const;
Channel_Manager& channel_manager() const;
void setDisconnectReason(ACE_UINT32 disconnect_reason) ;
ACE_UINT32 getDisconnectReason();
protected:
STATUS process_init ();
STATUS process_disconnect ();
STATUS process_service_request ();
STATUS process_userauth_request ();
STATUS process_global_message ();
STATUS process_tcp_forward ();
STATUS process_tcp_forward_cancel ();
STATUS process_udp_send_to ();
STATUS process_channel_open_reply (ACE_UINT8 status);
STATUS process_channel_open_direct ();
STATUS process_channel_window_adjust ();
STATUS process_channel_data ();
STATUS process_channel_close ();
virtual const char* identifier();
// ACE_Recursive_Thread_Mutex& socket_mutex();
private:
// Private function
STATUS sendAlertToSubscribMCList(mps__ConnectionStateTypeDefinition state,
ACE_CString &fqdn,
unsigned short port);
STATUS processReturnVal(STATUS rep);
STATUS process_KeepAliveReq();
STATUS process_KeepAliveOptionReq();
bool checkInFilter(const ACE_CString& host, const ACE_UINT32& port);
private:
ACE_UINT32 major_version_; // APF protocol major version
ACE_UINT32 minor_version_; // APF protocol minor version
ACE_UINT8 UUID_[16]; // AMT system ID
ACE_UINT32 trigger_reason_; // Reason for openning this tunnel
AMT_Tunnel_Handler* tunnel_handler_; // Reference to the tunnel Tunnel_Handler
};
#endif