Belle II Software  release-08-01-10
RSocketSend Class Reference
Inheritance diagram for RSocketSend:
Collaboration diagram for RSocketSend:

Public Member Functions

 RSocketSend (u_short port)
 
int examine ()
 
int accept ()
 
int close ()
 
int sock () const
 
int sender () const
 
void sock (int sockid)
 
int port () const
 
int get (char *data, int len)
 
int read (char *data, int len)
 
int put (char *data, int len)
 
int put_wordbuf (int *data, int len)
 
int write (char *data, int len)
 
int err () const
 
void interrupt ()
 
int put (int sock, char *data, int len)
 
int put_wordbuf (int sock, int *data, int len)
 
int get (int sock, char *data, int len)
 
int get_wordbuf (int sock, int *data, int len)
 
int get_pxd (int sock, char *data, int len)
 
int read_data (int sock, char *data, int len)
 
int write_data (int sock, char *data, int len)
 

Private Attributes

SocketIO m_io
 
int m_sock
 
int m_port
 
int m_sender
 
int m_errno
 
int m_int
 

Detailed Description

Definition at line 25 of file RSocketLib.h.

Member Function Documentation

◆ get_pxd()

int get_pxd ( int  sock,
char *  data,
int  len 
)
inherited

as this is fixed .... might not be needed if taken care of in unpacker

Definition at line 126 of file SocketLib.cc.

127 {
128 #define MAX_PXD_FRAMES 256
129  const int headerlen = 8;
130  int* pxdheader = (int*) data; // TODO should it be unsigned int?
131  int* pxdheadertable = (int*) &data[headerlen]; // TODO should it be unsigned int?
132  int framenr = 0, tablelen = 0, datalen = 0;
133  int br = read_data(sock, data, headerlen);
134  if (br <= 0) return br;
135  if (pxdheader[0] != htonl(0xCAFEBABE)) {
136  printf("pxdheader wrong : Magic %X , Frames %X \n", pxdheader[0], ntohl(pxdheader[1]));
137  exit(0);
138  }
139  pxdheader[0] = ntohl(pxdheader[0]);
140  framenr = pxdheader[1] = ntohl(pxdheader[1]);
141  if (framenr > MAX_PXD_FRAMES) {
142  printf("MAX_PXD_FRAMES too small : %d(%d) \n", framenr, MAX_PXD_FRAMES);
143  exit(0);
144  }
145  tablelen = 4 * framenr;
146  br = read_data(sock, (char*)&data[headerlen], tablelen);
147  if (br <= 0) return br;
148  for (int i = 0; i < framenr; i++) {
149  pxdheadertable[i] = ntohl(pxdheadertable[i]);
150  datalen += (pxdheadertable[i] + 3) & 0xFFFFFFFC;
151  }
152 
153  if (datalen + headerlen + tablelen > len) {
154  printf("buffer too small : %d %d %d(%d) \n", headerlen, tablelen, datalen, len);
155  exit(0);
156  }
157  int bcount = read_data(sock, data + headerlen + tablelen, datalen);
158  if (br <= 0) return br;
159  return (headerlen + tablelen + bcount);
160 }

The documentation for this class was generated from the following files: