Click here to Skip to main content
15,881,898 members
Articles / Programming Languages / C++

A Simple and Easy to Use IOCP Server Framework

Rate me:
Please Sign up or sign in to vote.
3.43/5 (8 votes)
30 Jun 2008LGPL33 min read 44.1K   1.7K   35  
An introduction to SPServer Framework
/*
 * Copyright 2007 Stephen Liu
 * For license terms, see the file COPYING along with this library.
 */

#ifndef __spgnutls_hpp__
#define __spgnutls_hpp__

#include "spiochannel.hpp"

struct gnutls_session_int;
struct gnutls_certificate_credentials_st;

class SP_GnutlsChannel : public SP_IOChannel {
public:
	SP_GnutlsChannel( struct gnutls_certificate_credentials_st * cred );
	virtual ~SP_GnutlsChannel();

	virtual int init( int fd );

	virtual int receive( SP_Session * session );

private:
	virtual int write_vec( struct iovec * vector, int count );

	gnutls_session_int * mTls;
	gnutls_certificate_credentials_st * mCred;
};

class SP_GnutlsChannelFactory : public SP_IOChannelFactory {
public:

	enum { DH_BITS = 1024 };

	SP_GnutlsChannelFactory();
	virtual ~SP_GnutlsChannelFactory();

	virtual SP_IOChannel * create() const;

	int init( const char * certFile, const char * keyFile );

private:
	gnutls_certificate_credentials_st * mCred;
};

#endif

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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


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

Comments and Discussions