88 lines
1.6 KiB
C++
88 lines
1.6 KiB
C++
//
|
|
// Stdio Daemon
|
|
// Neal Probert
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __StdioDaemon__
|
|
#define __StdioDaemon__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "bzlib.h"
|
|
|
|
#include "TcpDaemon.h"
|
|
#include "TcpClient.h"
|
|
#include "UdpClient.h"
|
|
#include "UdpCaster.h"
|
|
|
|
#include "LogData.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
#define STDIOD_NAME "stdiod"
|
|
#define STDIOD_SERVICE "stdiod"
|
|
#define STDIOD_PORT "2941"
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
//
|
|
// Uses the Peak Systems CAN Linux driver and Nissan CAN data
|
|
//
|
|
class StdioDaemon : public TcpDaemon {
|
|
// public data
|
|
public:
|
|
|
|
// private data
|
|
private:
|
|
// FDs
|
|
int m_Stdin;
|
|
int m_RemoteIn;
|
|
int m_DgramIn;
|
|
|
|
// TCP client
|
|
TcpClient Client;
|
|
|
|
// UDP listen
|
|
UdpClient Dgram;
|
|
|
|
// UDP broadcast
|
|
UdpCaster Bcast;
|
|
|
|
// misc
|
|
|
|
// private methods
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
StdioDaemon();
|
|
|
|
// destructor
|
|
virtual ~StdioDaemon();
|
|
|
|
// virtual functions
|
|
int ServerSocket(void);
|
|
int ClientIn( int sock, const char *buf, int n );
|
|
void ClientCast( const char *buf, int n );
|
|
|
|
// public methods
|
|
int TcpConnect( const char *uri );
|
|
|
|
int UdpBroadcast( const char *uri );
|
|
int UdpListen( const char *uri );
|
|
|
|
// static methods
|
|
|
|
// private methods
|
|
private:
|
|
};
|
|
|
|
#endif
|