Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

tcp_srv.hh

Go to the documentation of this file.
00001 
00002 #ifndef TCP_SRV_HH
00003 #define TCP_SRV_HH
00004 
00005 #include "cms_srv.hh"           /* class CMS_SERVER_REMOTE_PORT */
00006 #include "linklist.hh"          /* class RCS_LINKED_LIST */
00007 #include "rcs_defs.hh"          /* EXTERN_C_STD_HEADERS */
00008 #include "sokintrf.h"           // fd_set, sockaddr_in, timeval
00009 #include "rem_msg.hh"
00010 
00011 #ifdef EXTERN_C_STD_HEADERS
00012 extern "C"
00013 {
00014 #endif
00015 
00016 #include <string.h>             /* memset(), strerror() */
00017 
00018 #ifndef UNDER_CE
00019 #include <errno.h>              /* errno */
00020 #include <signal.h>             // SIGPIPE, signal()
00021 #endif
00022 
00023 #ifdef EXTERN_C_STD_HEADERS
00024 }
00025 #endif
00026 
00027 #ifndef NO_THREADS
00028 #ifdef sunos5
00029 #include <thread.h>
00030 #endif
00031 
00032 #ifdef linux
00033 #define NO_THREADS
00034 #endif
00035 
00036 #ifdef POSIX_THREADS
00037 #include <pthread.h>
00038 #endif
00039 
00040 #endif
00041 
00042 #include "dbg_mem.h"            /* DEBUG_FREE,DEBUG_MALLOC,DEBUG_CALLOC */
00043 
00044 #define MAX_TCP_BUFFER_SIZE 16
00045 class CLIENT_TCP_PORT;
00046 
00047 class CMS_SERVER_REMOTE_TCP_PORT:public CMS_SERVER_REMOTE_PORT
00048 {
00049 public:
00050   CMS_SERVER_REMOTE_TCP_PORT (CMS_SERVER * _cms_server);
00051   virtual ~ CMS_SERVER_REMOTE_TCP_PORT ();
00052   int accept_local_port_cms (CMS *);
00053   void run ();
00054   void register_port ();
00055   void unregister_port ();
00056   double dtimeout;
00057 protected:
00058     fd_set read_fd_set, write_fd_set;
00059   void handle_request (CLIENT_TCP_PORT *);
00060   int maxfdpl;
00061   RCS_LINKED_LIST *client_ports;
00062   RCS_LINKED_LIST *subscription_buffers;
00063   int connection_socket;
00064   long connection_port;
00065   struct sockaddr_in server_socket_address;
00066   REMOTE_CMS_REQUEST *request;
00067   char temp_buffer[0x2000];
00068   int current_poll_interval_millis;
00069   int polling_enabled;
00070   struct timeval select_timeout;
00071   void update_subscriptions ();
00072   void add_subscription_client (int buffer_number, int subscription_type,
00073                                 int poll_interval_millis,
00074                                 CLIENT_TCP_PORT * clnt);
00075   void remove_subscription_client (CLIENT_TCP_PORT * clnt, int buffer_number);
00076   void recalculate_polling_interval ();
00077   void CMS_SERVER_REMOTE_TCP_PORT::switch_function (CLIENT_TCP_PORT *
00078                                                     _client_tcp_port,
00079                                                     CMS_SERVER * server,
00080                                                     long request_type,
00081                                                     long buffer_number,
00082                                                     long
00083                                                     received_serial_number);
00084 };
00085 
00086 class TCP_BUFFER_SUBSCRIPTION_INFO
00087 {
00088 public:
00089   TCP_BUFFER_SUBSCRIPTION_INFO ();
00090   ~TCP_BUFFER_SUBSCRIPTION_INFO ();
00091   int buffer_number;
00092   int min_last_id;
00093   int list_id;
00094   RCS_LINKED_LIST *sub_clnt_info;
00095 };
00096 
00097 class TCP_CLIENT_SUBSCRIPTION_INFO
00098 {
00099 public:
00100   TCP_CLIENT_SUBSCRIPTION_INFO ();
00101   ~TCP_CLIENT_SUBSCRIPTION_INFO ();
00102   int subscription_type;
00103   int poll_interval_millis;
00104   double last_sub_sent_time;
00105   int subscription_list_id;
00106   int buffer_number;
00107   int subscription_paused;
00108   int last_id_read;
00109   TCP_BUFFER_SUBSCRIPTION_INFO *sub_buf_info;
00110   CLIENT_TCP_PORT *clnt_port;
00111 };
00112 
00113 class TCPSVR_BLOCKING_READ_REQUEST;
00114 
00115 class CLIENT_TCP_PORT
00116 {
00117 public:
00118   CLIENT_TCP_PORT ();
00119   ~CLIENT_TCP_PORT ();
00120   long serial_number;
00121   int errors, max_errors;
00122   struct sockaddr_in address;
00123   int socket_fd;
00124   RCS_LINKED_LIST *subscriptions;
00125 #if defined(WIN32) && !defined(gnuwin32)
00126   DWORD tid;
00127   DWORD pid;
00128 #else
00129 #ifdef VXWORKS
00130   int tid;
00131   int pid;
00132 #else
00133   pid_t tid;
00134   pid_t pid;
00135 #endif
00136 #endif
00137   int blocking;
00138 #if defined(sunos5) && !defined(NO_THREADS)
00139   thread_t threadId;
00140 #else
00141 #ifdef POSIX_THREADS
00142   pthread_t threadId;
00143 #else
00144   int threadId;
00145 #endif
00146 #endif
00147   TCPSVR_BLOCKING_READ_REQUEST *blocking_read_req;
00148   REMOTE_SET_DIAG_INFO_REQUEST *diag_info;
00149 
00150 };
00151 
00152 class TCPSVR_BLOCKING_READ_REQUEST:public REMOTE_BLOCKING_READ_REQUEST
00153 {
00154 public:
00155   TCPSVR_BLOCKING_READ_REQUEST ();
00156   ~TCPSVR_BLOCKING_READ_REQUEST ();
00157   CLIENT_TCP_PORT *_client_tcp_port;
00158   CMS_SERVER_REMOTE_TCP_PORT *remport;
00159   CMS_SERVER *server;
00160   REMOTE_BLOCKING_READ_REPLY *read_reply;
00161 };
00162 
00163 
00164 
00165 
00166 #endif /* TCP_SRV_HH */

Generated on Sun Dec 2 15:56:52 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001