StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RC_Msg.hh
1 #ifndef RC_MSG_HEADER
2 #define RC_MSG_HEADER
3 
4 #include <stdio.h>
5 #include <sys/types.h>
6 #include <string.h>
7 #include "iccp.h"
8 #include "RC_MsgDefs.h"
9 
10 #ifdef DEFINE_ONLINE
11 #include <string>
12 #endif
13 
14 class RcComInfo;
15 
17 {
18  RcComInfo *origin;
19  u_int Seq; // a sequence number - connection_seq
20  // seq by value! starts out same as from origin
21 };
22 
23 MsgEnvHeader msg_env(RcComInfo *info);
24 
25 class RcMsg
26 {
27 public:
28  MsgEnvHeader envelope; // wrapped around external communication
29  ic_msg_head head; // iccp header
30  union
31  {
32  // Generic types
33  char data[RCDATASIZE];
34  uchar byte[RCDATASIZE];
35  uint dword[RCDATASIZE/4];
36  ushort word[RCDATASIZE/2];
37 
38  // Message types
39  // Internal Handler commands
40  rc_daq_connect daq_connect;
41  rc_daq_error daq_error;
42 
43  // handler --> rc
44  rc_cmd_response cmd_response;
45  rc_drc_send_error drc_send_error;
46 
47  // rc --> handler
48  rc_drc_connect drc_connect;
49  rc_cmd_nop cmd_nop;
50  rc_drc_ping drc_ping;
51  rc_drc_stophandler drc_stophandler;
52  rc_drc_clear_handler drc_clear_handler;
53  rc_drc_querysystem drc_querysystem;
54  rc_drc_get_systems drc_get_systems;
55  rc_drc_get_threads drc_get_threads;
56  rc_cmd_timeout cmd_timeout;
57  rc_drc_reconfig drc_reconfig;
58  rc_drc_add_component drc_add_component;
59  rc_cmd_reboot cmd_reboot;
60  rc_drc_run_start drc_run_start;
61  rc_drc_run_stop drc_run_stop;
62  rc_drc_run_pause drc_run_pause;
63  rc_drc_run_resume drc_run_resume;
64  rc_drc_set_config drc_set_config;
65  rc_drc_get_config drc_get_config;
66  rc_drc_send_config drc_send_config;
67  rc_drc_set_busy drc_set_busy;
68  rc_drc_release_busy drc_release_busy;
69  rc_drc_flush_tokens drc_flush_tokens;
70  rc_drc_query_tokens drc_query_tokens;
71  rc_drc_client_control drc_client_control;
72  rc_drc_reconnect drc_reconnect;
73  rc_drc_get_errors drc_get_errors;
74  rc_drc_clear_errors drc_clear_errors;
75  rc_drc_update_query drc_update_query;
76 
77  // system --> Handler
78  rc_cmd_ack cmd_ack;
79  rc_cmd_ping cmd_ping;
80  rc_daq_run_start daq_run_start;
81  rc_daq_run_stop daq_run_stop;
82  rc_daq_run_pause daq_run_pause;
83  rc_daq_run_resume daq_run_resume;
84  rc_daq_send_config daq_send_config;
85  rc_daq_send_config daq_send_reconfig;
86  rc_daq_set_busy daq_set_busy;
87  rc_daq_release_busy daq_release_busy;
88  rc_daq_flush_tokens daq_flush_tokens;
89  rc_daq_query_tokens daq_query_tokens;
90  rc_mz_emul_fiber mz_emul_fiber;
91  rc_rts_reconnect rts_reconnect;
92  rc_drc_monitor_send drc_monitor_send;
93  };
94 
95  void AddEnvelope(const MsgEnvHeader& env)
96  {
97  envelope = env;
98  };
99 
100  void make_LOG_DATA(char *str);
101  void Clear(const MsgEnvHeader& env, unsigned char st,
102  unsigned char dt, unsigned char cmd=0);
103  void Write(FILE* fd);
104  int Rcv(u_int fd, bool handshake=false) ;
105  int Snd(u_int fd, bool handshake=true) ;
106  int SockPeekHeader(u_int fd, u_int timeout); // Peek at a socket (timeout uSec)
107  void Dump(FILE* fd);
108 };
109 
110 #endif
111 
Definition: RC_Msg.hh:25