Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:42

0001 #ifndef __REMOTE_MSG_BUFFER_H__
0002 #define __REMOTE_MSG_BUFFER_H__
0003 
0004 
0005 
0006 #include "msg_buffer.h"
0007 
0008 #ifndef __CINT__
0009 
0010 #include <sys/types.h>
0011 #include <unistd.h>
0012 #include <stdlib.h>
0013 #include <sys/socket.h>
0014 #include <sys/types.h>
0015 #include <sys/stat.h>
0016 #include <sys/times.h>
0017 
0018 #include <netdb.h>
0019 #include <netinet/in.h>
0020 #include <arpa/inet.h>
0021 
0022 #endif
0023 
0024 
0025 
0026 /** This is the "filter" msg\_buffer class which allows you to filter
0027 messages based on their profile. Its default behavior is to let all messages pass. 
0028 You can use the member functions to tailor the kind of messages filtered and passed on.
0029 
0030 */
0031 
0032 class remote_msg_buffer : public   msg_buffer {
0033 
0034 protected:
0035 
0036 #ifndef __CINT__
0037   STREAMBUF * original_streambuf;
0038   int ThePort;
0039   char *TheHost;
0040 
0041   int sockfd;
0042   struct sockaddr_in server_addr;
0043   struct hostent *p_host;
0044 
0045   void send_string(const char *x, const int len);
0046   int writen (int fd, const char *ptr, int nbytes);
0047 #endif
0048 
0049 
0050 public:
0051 
0052 
0053   /** The msglen parameter specifies the initial length of the 
0054       message string which is kept internally. If you exceed the length, 
0055       it is automautically extended.
0056   */
0057   remote_msg_buffer (const char *host = "va010.phenix.bnl.gov",
0058              const int port = 8400, const int msglen=256);
0059 
0060   /// the virtual destructor
0061   virtual ~remote_msg_buffer();
0062 
0063   /// the sync function overrides the streambuf's sync function
0064 
0065   // mlp -- the pubsync is what's needed for the new
0066   // iostream libraries - sync will no longer be a public method. 
0067   // for now we leave it as it was.
0068 
0069 #ifdef STREAMBUF_NEW_IOSTREAM
0070   virtual int pubsync ();
0071 #else
0072   virtual int sync ();
0073 #endif
0074 
0075 
0076 };
0077 
0078 
0079 #endif /* __REMOTE_MSG_BUFFER_H__ */