Evita  0.16
evChannel.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evChannel_h
25 #define __evChannel_h
26 
27 
28 #include <sys/select.h>
29 #include <sys/types.h>
30 #include <sys/socket.h>
31 #include <sys/time.h>
32 #include <netinet/in.h>
33 #include <arpa/inet.h>
34 #include <netdb.h>
35 
36 #include "evSignal.h"
37 #include "evBitBuffer.h"
38 
39 
40 #define EVPORT_COMMANDCHANNEL 11900
41 
42 #define EVPORT_BITSTREAMCHANNEL 11901
43 #define EVPORT_PRIORITYSCHEDULECHANNEL 11902
44 
45 #define EVCHANNEL_FROMCHANNEL "**channel**"
46 
47 #define EVCHANNEL_SERVERTIMEOUT 5
48 #define EVCHANNEL_NOFORK 0
49 #define EVCHANNEL_FORK 1
50 #define EVCHANNEL_NOWAIT 0
51 #define EVCHANNEL_WAIT 1
52 
53 
54 class evChannel : public evBitBuffer
55 {
56 public:
57  evChannel(void);
58  virtual ~evChannel(void);
59 
60  virtual const evString GetClassName(void) const
61  {
62  return(evString("evChannel"));
63  }
64 
65  int Close(void);
66 
67  int Create(const int port);
68  int GetClientConnection(const int direction,
69  const int fork_process,
70  const int wait);
71 
72  int ConnectToServer(const evString &hostname,
73  const int port,
74  const int direction);
75 
76  int IsReady(void);
77 
78  int CopyFileToChannel(const evString &filename);
79 
80  int ReadCommand(evString &command);
81  int ReadCommandValue(int &command_value);
82  int ReadCommandValue(double &command_value);
83  int ReadCommandValue(evString &command_value);
84  int ReadCommandValue(evVector &command_value);
85  int WriteCommand(const evString &command);
86  int WriteCommand(const evString &command, const int command_value);
87  int WriteCommand(const evString &command, const double command_value);
88  int WriteCommand(const evString &command, const evString &command_value);
89  int WriteCommand(const evString &command, const evVector &command_value);
90 
91 protected:
92 
93 private:
94  int Socket;
95  struct sockaddr_in LocalAddress;
96  struct sockaddr_in RemoteAddress;
98 
99  static void CleanupChildren(int signal_number);
100 
101 };
102 
103 
104 
105 #endif
int ReadCommandValue(int &command_value)
struct sockaddr_in RemoteAddress
Definition: evChannel.h:96
int Socket
Definition: evChannel.h:94
evString RemoteHost
Definition: evChannel.h:97
static void CleanupChildren(int signal_number)
int ReadCommand(evString &command)
virtual ~evChannel(void)
Definition: evVector.h:36
evChannel(void)
Definition: evChannel.h:54
int Close(void)
Definition: evBitBuffer.h:34
virtual const evString GetClassName(void) const
Definition: evChannel.h:60
int IsReady(void)
int ConnectToServer(const evString &hostname, const int port, const int direction)
int GetClientConnection(const int direction, const int fork_process, const int wait)
int Create(const int port)
int CopyFileToChannel(const evString &filename)
struct sockaddr_in LocalAddress
Definition: evChannel.h:95
Definition: evString.h:30
int WriteCommand(const evString &command)