35 #if defined (G4VIS_BUILD_DAWN_DRIVER) || defined (G4VIS_USE_DAWN)
39 #if !defined G4FR_CLIENT_SERVER_H
40 #define G4FR_CLIENT_SERVER_H
43 #include<sys/socket.h>
44 #include<netinet/in.h>
56 const char FR_ENV_SERVER_HOST_NAME[] =
"G4DAWN_HOST_NAME" ;
57 const char FR_ENV_NAMED_PIPE_CONNECTION[] =
"G4DAWN_NAMED_PIPE" ;
63 class G4FRClientServer {
65 enum { SEND_BUFMAX = 1024 , RECV_BUFMAX = 1024 };
66 enum { SUN_PATH_MAX = 16 };
69 const char TERMINATOR ;
70 const char END_OF_LINE;
71 char SUN_PATH[ SUN_PATH_MAX ];
75 char fReceivedMessage [ RECV_BUFMAX ];
76 char fSendingMessage [ SEND_BUFMAX ];
80 void Err(
const char*
message ) { perror(message) ;}
81 void SetSendingMessage(
const char*
message )
82 { strcpy( fSendingMessage, message );}
87 int AcceptUnix(){
return 0;}
88 int AcceptINET(){
return 0 ;}
97 G4FRClientServer (
char terminator =
'.' ,
98 char end_line =
'\n' ) ;
99 virtual ~G4FRClientServer () {;}
100 void SetSunPath(
const char* sun_path )
101 { strcpy ( SUN_PATH, sun_path ); }
102 void SetPortNumber(
int port_num )
103 { PORT_NUMBER = port_num ; }
104 void IncrementPortNumber(
int incr = 1 )
105 { PORT_NUMBER += incr ; }
106 const char* GetSendingMessage()
const
107 {
return fSendingMessage ;}
108 int GetSendingMessageLength()
const
109 {
return strlen(fSendingMessage) ;}
110 void SetReceivedMessage(
const char*
message )
111 { strcpy( fReceivedMessage, message );}
112 const char* GetReceivedMessage()
const
113 {
return fReceivedMessage ;}
114 int GetReceivedMessageLength()
const
115 {
return strlen(fReceivedMessage) ;}
116 int GetSofd()
const {
return fSocketFd ; }
117 int GetPortNumber ()
const {
return PORT_NUMBER ; }
118 void ClearReceivedMessage ()
119 { memset(fReceivedMessage,
'\0', RECV_BUFMAX) ; }
121 int IsTerminator(
char ch ) {
return ( ch == TERMINATOR ); }
122 char GetTerminator()
const {
return TERMINATOR ; }
123 int IsEndOfLine (
char ch ) {
return ( ch == END_OF_LINE ); }
124 char GetEndOfLine()
const {
return END_OF_LINE ; }
127 void WaitSendBack(
const char* command_string ) ;
130 virtual void Send (
const char*
message ) ;
131 virtual void SendLine (
const char*
message ) ;
134 virtual void Receive() ;
135 virtual void ReceiveLine() ;
141 #endif //G4VIS_BUILD_DAWN_DRIVER
void message(RunManager *runmanager)