Click here to Skip to main content
15,896,207 members
Articles / Programming Languages / C++

HTTP Tunneling

Rate me:
Please Sign up or sign in to vote.
4.73/5 (38 votes)
14 Jun 2000 464.8K   17K   128  
This article describes how to open arbitrary TCP connections through proxy servers
#ifndef ___obj_managers_h__
#define ___obj_managers_h__

/*
Generic object manager
Traits for the managed objects the object
*/
template< class T >
struct _object_manager
{
	// Managed type
	typedef T managed_type;	

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
	}

	// Function name	: delete_object
	// Description	    : Destroys the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
	}
};

/*
Pointer manager
*/
template< class T >
struct _pointer_manager :
	public _object_manager< T >
{

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
		a = NULL;
	}

	// Function name	: delete_object
	// Description	    : Deletes the pointer
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
		if( a != NULL )
		{
			delete a;
			a = NULL;
		}
	}
};

/*
Array manager
*/
template< class T >
struct _array_manager :
	public _object_manager< T >
{

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
		a = NULL;
	}

	// Function name	: delete_object
	// Description	    : Deletes the array
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
		if( a != NULL )
		{
			delete[] a;
			a = NULL;
		}
	}
};


#endif // ___obj_managers_h__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions