Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > contrib-release-debug > by-pkgid > e4ce2fe9480cf5fdd44870ed0dd19474 > files > 39

dssl-debug-1.4.4-6mdv2011.0.i586.rpm

/*
** This file is a part of DSSL library.
**
** Copyright (C) 2008, SSLTech LLC
** Copyright (C) 2005-2008, Vladimir Shcherbakov <vladimir@ssltech.net>
**
** 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 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
*/
#ifndef __DSSL_SESSION_H__
#define __DSSL_SESSION_H__

#include "dssl_defs.h"
#include "stream.h"

#ifdef  __cplusplus
extern "C" {
#endif

struct _TcpSession
{
	/* Session type - TCP/SSL/Null */
	NM_SessionType		type;
	/* session TCP stream objects */
	TcpStream			clientStream;
	TcpStream			serverStream;
	/* next session in chain (used in session hash table)*/
	struct _TcpSession*	next;
	NM_PacketDir		lastPacketDirection;
	/* session closure flag */
	int					closing;
	/* callback routines for data and error processing */
	DataCallbackProc	data_callback;
	ErrorCallbackProc	error_callback;
	void*				user_data;
	/* current packet timestamp (taken from the packet's header) */
	struct timeval		packet_time;		
	/* last session activity time */
	time_t				last_update_time; 
	/* reassembled packet callback */
	int (*OnNewPacket)( struct _TcpStream* stream, DSSL_Pkt* pkt );
	/* corresponding SSL session struct (SSL session type only) */
	struct DSSL_Session_*	ssl_session;
};

/* Init/Free session */
int SessionInit( CapEnv* env, TcpSession* s, DSSL_Pkt* pkt, NM_SessionType s_type );
void SessionFree( TcpSession* s );

NM_PacketDir SessionGetPacketDirection(const TcpSession* sess, DSSL_Pkt* pkt );

/* packet processing entry point */
void SessionProcessPacket( struct CapEnv_* env, DSSL_Pkt* pkt );

/* updates the last activity time (set it to current time) */
void TouchSession( TcpSession* s );

/*Get/Set session callbacks, user data */
void SessionSetCallback( TcpSession* sess, DataCallbackProc data_callback, 
			ErrorCallbackProc error_callback, void* user_data );

void SessionSetUserData( TcpSession* sess, void* data );
void* SessionGetUserData( const TcpSession* sess );

#ifdef  __cplusplus
}
#endif

#endif