File: MonitorConn.h

package info (click to toggle)
libassa 3.5.1-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,424 kB
  • sloc: cpp: 15,703; sh: 12,083; makefile: 379; perl: 51
file content (61 lines) | stat: -rw-r--r-- 2,109 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// -*- c++ -*-
//------------------------------------------------------------------------------
//                               MonitorConn.h
//------------------------------------------------------------------------------
// $Id: MonitorConn.h,v 1.2 2006/07/20 02:30:55 vlg Exp $
//------------------------------------------------------------------------------
//  Copyright (c) 2002 by Vladislav Grinchenko
//
//  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.
//------------------------------------------------------------------------------
// Created: Thu Apr 17 23:22:39 EDT 2003
//------------------------------------------------------------------------------
#ifndef MONITOR_CONN_H
#define MONITOR_CONN_H

#include <assa/ServiceHandler.h>
#include <assa/IPv4Socket.h>

using ASSA::ServiceHandler;
using ASSA::IPv4Socket;

class Conn;

/*******************************************************************************
 Class MonitorConn
*******************************************************************************/

class MonitorConn : public ServiceHandler<IPv4Socket>
{
public:
	MonitorConn (IPv4Socket* stream_);
	~MonitorConn ();

	virtual int open ();

	virtual int handle_read (int fd_);
	virtual int handle_close (int /* fd */);
	void notify (const char* msg_);

private:
	static const size_t MAXMSGLEN = 128;    // Maximum message length
	void parse_record ();
	void process_get_cmd (const std::string& token_);
	void process_list_cmd ();

private:
	u_int m_iolen;				// Number of bytes in I/O buffer so far
	char  m_iobuf [MAXMSGLEN];	// Message buffer
	Conn* m_current_conn;
	char m_eor [2];				// End-of-Record
};

/*******************************************************************************
 Useful defines
*******************************************************************************/

#endif /* MONITOR_CONN_H */