Update of /cvsroot/emc/rcslib/src/cms
In directory sc8-pr-cvs1:/tmp/cvs-serv11714/src/cms
Modified Files:
Tag: wps_multiplat_dev_branch
Makefile Makefile.lib cms_xup.cc cms_xup.hh http_srv.cc
http_srv.hh httpnml.cc recvn.c sendn.c sendn.h sokintrf.h
tcp_srv.cc tcp_srv.hh tcpmem.cc udp_srv.hh
Log Message:
.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/Makefile,v
retrieving revision 4.50.2.2
retrieving revision 4.50.2.3
diff -C2 -d -r4.50.2.2 -r4.50.2.3
*** Makefile 8 Aug 2003 15:08:48 -0000 4.50.2.2
--- Makefile 21 Aug 2003 20:24:14 -0000 4.50.2.3
***************
*** 8,12 ****
clean distclean check distcheck install:
! ../../etc/multiplatbuild.sh config $@
.PHONY: all config clean distclean check distcheck install
--- 8,12 ----
clean distclean check distcheck install:
! ../../etc/multiplatbuild.sh $@
.PHONY: all config clean distclean check distcheck install
Index: Makefile.lib
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/Makefile.lib,v
retrieving revision 4.56.2.1
retrieving revision 4.56.2.2
diff -C2 -d -r4.56.2.1 -r4.56.2.2
*** Makefile.lib 8 Aug 2003 14:21:07 -0000 4.56.2.1
--- Makefile.lib 21 Aug 2003 20:24:14 -0000 4.56.2.2
***************
*** 447,450 ****
--- 447,451 ----
rtlnml.h \
cms_cfg_no_config.h \
+ cms_xup_no_config.h \
cmsdiag_no_config.h \
sokintrf_no_config.h \
Index: cms_xup.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/cms_xup.cc,v
retrieving revision 4.35
retrieving revision 4.35.2.1
diff -C2 -d -r4.35 -r4.35.2.1
*** cms_xup.cc 6 May 2003 15:18:14 -0000 4.35
--- cms_xup.cc 21 Aug 2003 20:24:14 -0000 4.35.2.1
***************
*** 13,21 ****
/* Includes */
- extern "C"
- {
- #include <stdlib.h> /* malloc(), free() */
! };
#include "dbg_mem.h" /* DEBUG_FREE,DEBUG_MALLOC,DEBUG_CALLOC */
--- 13,24 ----
/* Includes */
! #ifdef HAVE_CONFIG_H
! #include "rcs_config_include.h"
!
! #else
! #include "cms_xup_no_config.h"
! #endif
! // HAVE_CONFIG_H
#include "dbg_mem.h" /* DEBUG_FREE,DEBUG_MALLOC,DEBUG_CALLOC */
***************
*** 207,218 ****
if (NULL != encode_data_stream)
{
! xdr_destroy (encode_data_stream);
! DEBUG_FREE (encode_data_stream);
encode_data_stream = (XDR *) NULL;
}
if (NULL != decode_data_stream)
{
! xdr_destroy (decode_data_stream);
! DEBUG_FREE (decode_data_stream);
decode_data_stream = (XDR *) NULL;
}
--- 210,221 ----
if (NULL != encode_data_stream)
{
! xdr_destroy (((XDR *)encode_data_stream));
! DEBUG_FREE (((XDR *)encode_data_stream));
encode_data_stream = (XDR *) NULL;
}
if (NULL != decode_data_stream)
{
! xdr_destroy (((XDR *)decode_data_stream));
! DEBUG_FREE (((XDR *)decode_data_stream));
decode_data_stream = (XDR *) NULL;
}
***************
*** 288,292 ****
else
{
! xdr_destroy (encode_data_stream);
}
if (NULL == encode_data_stream)
--- 291,295 ----
else
{
! xdr_destroy (((XDR *)encode_data_stream));
}
if (NULL == encode_data_stream)
***************
*** 302,306 ****
else
{
! xdr_destroy (decode_data_stream);
}
if (NULL == decode_data_stream)
--- 305,309 ----
else
{
! xdr_destroy (((XDR *)decode_data_stream));
}
if (NULL == decode_data_stream)
***************
*** 322,328 ****
nsize = cms_parent->enc_max_size;
}
! xdrmem_create (encode_data_stream, (char *) encoded_data, nsize,
XDR_ENCODE);
! xdrmem_create (decode_data_stream, (char *) encoded_data, nsize,
XDR_DECODE);
--- 325,331 ----
nsize = cms_parent->enc_max_size;
}
! xdrmem_create (((XDR *)encode_data_stream), (char *) encoded_data, nsize,
XDR_ENCODE);
! xdrmem_create (((XDR *)decode_data_stream), (char *) encoded_data, nsize,
XDR_DECODE);
***************
*** 383,387 ****
(mode == CMS_ENCODE_DATA) || (mode == CMS_DECODE_DATA))
{
! int xdr_pos = xdr_getpos (current_stream);
if (xdr_pos + _bytes > encoded_data_size)
{
--- 386,390 ----
(mode == CMS_ENCODE_DATA) || (mode == CMS_DECODE_DATA))
{
! int xdr_pos = xdr_getpos (((XDR *) current_stream));
if (xdr_pos + _bytes > encoded_data_size)
{
***************
*** 402,406 ****
if (NULL != current_stream)
{
! xdr_setpos (current_stream, 0);
}
else
--- 405,409 ----
if (NULL != current_stream)
{
! xdr_setpos (((XDR *) current_stream), 0);
}
else
***************
*** 425,429 ****
return (-1);
}
! return (xdr_getpos (current_stream));
}
--- 428,432 ----
return (-1);
}
! return (xdr_getpos (((XDR *) current_stream)));
}
***************
*** 438,442 ****
return (CMS_UPDATE_ERROR);
}
! if (xdr_char (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_char failed.\n");
--- 441,445 ----
return (CMS_UPDATE_ERROR);
}
! if (xdr_char (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_char failed.\n");
***************
*** 454,458 ****
}
! if (xdr_bytes (current_stream, (char **) &x, &len, len) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
--- 457,461 ----
}
! if (xdr_bytes (((XDR *) current_stream), (char **) &x, &len, len) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
***************
*** 469,473 ****
return (CMS_UPDATE_ERROR);
}
! if (xdr_u_char (current_stream, (unsigned char *) &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_char failed.\n");
--- 472,476 ----
return (CMS_UPDATE_ERROR);
}
! if (xdr_u_char (((XDR *) current_stream), (unsigned char *) &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_char failed.\n");
***************
*** 485,489 ****
}
! if (xdr_bytes (current_stream, (char **) &x, &len, len) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
--- 488,492 ----
}
! if (xdr_bytes (((XDR *) current_stream), (char **) &x, &len, len) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_bytes failed.\n");
***************
*** 503,507 ****
}
! if (xdr_short (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_short failed.\n");
--- 506,510 ----
}
! if (xdr_short (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_short failed.\n");
***************
*** 519,523 ****
}
! if (xdr_vector (current_stream, (char *) x, len, sizeof (short),
(xdrproc_t) xdr_short) != TRUE)
{
--- 522,526 ----
}
! if (xdr_vector (((XDR *) current_stream), (char *) x, len, sizeof (short),
(xdrproc_t) xdr_short) != TRUE)
{
***************
*** 536,540 ****
}
! if (xdr_u_short (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_short failed.\n");
--- 539,543 ----
}
! if (xdr_u_short (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_short failed.\n");
***************
*** 553,557 ****
}
! if (xdr_vector (current_stream,
(char *) x, len,
sizeof (unsigned short), (xdrproc_t) xdr_u_short) != TRUE)
--- 556,560 ----
}
! if (xdr_vector (((XDR *) current_stream),
(char *) x, len,
sizeof (unsigned short), (xdrproc_t) xdr_u_short) != TRUE)
***************
*** 573,577 ****
}
! if (xdr_int (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_int failed.\n");
--- 576,580 ----
}
! if (xdr_int (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_int failed.\n");
***************
*** 587,591 ****
return (CMS_UPDATE_ERROR);
}
! if (xdr_vector (current_stream, (char *) x, len, sizeof (int),
(xdrproc_t) xdr_int) != TRUE)
{
--- 590,594 ----
return (CMS_UPDATE_ERROR);
}
! if (xdr_vector (((XDR *) current_stream), (char *) x, len, sizeof (int),
(xdrproc_t) xdr_int) != TRUE)
{
***************
*** 603,607 ****
}
! if (xdr_u_int (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_int failed.\n");
--- 606,610 ----
}
! if (xdr_u_int (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_int failed.\n");
***************
*** 618,622 ****
}
! if (xdr_vector (current_stream,
(char *) x, len,
sizeof (unsigned int), (xdrproc_t) xdr_u_int) != TRUE)
--- 621,625 ----
}
! if (xdr_vector (((XDR *) current_stream),
(char *) x, len,
sizeof (unsigned int), (xdrproc_t) xdr_u_int) != TRUE)
***************
*** 639,643 ****
}
! if (xdr_long (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_long failed.\n");
--- 642,646 ----
}
! if (xdr_long (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_long failed.\n");
***************
*** 654,658 ****
}
! if (xdr_vector (current_stream, (char *) x, len, sizeof (long),
(xdrproc_t) xdr_long) != TRUE)
{
--- 657,661 ----
}
! if (xdr_vector (((XDR *) current_stream), (char *) x, len, sizeof (long),
(xdrproc_t) xdr_long) != TRUE)
{
***************
*** 670,674 ****
}
! if (xdr_u_long (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_long failed.\n");
--- 673,677 ----
}
! if (xdr_u_long (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_u_long failed.\n");
***************
*** 686,690 ****
}
! if (xdr_vector (current_stream,
(char *) x, len, sizeof (unsigned long),
(xdrproc_t) xdr_u_long) != TRUE)
--- 689,693 ----
}
! if (xdr_vector (((XDR *) current_stream),
(char *) x, len, sizeof (unsigned long),
(xdrproc_t) xdr_u_long) != TRUE)
***************
*** 706,710 ****
}
! if (xdr_float (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_float failed.\n");
--- 709,713 ----
}
! if (xdr_float (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_float failed.\n");
***************
*** 721,725 ****
}
! if (xdr_vector (current_stream, (char *) x, len, sizeof (float),
(xdrproc_t) xdr_float) != TRUE)
{
--- 724,728 ----
}
! if (xdr_vector (((XDR *) current_stream), (char *) x, len, sizeof (float),
(xdrproc_t) xdr_float) != TRUE)
{
***************
*** 738,742 ****
}
! if (xdr_double (current_stream, &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
--- 741,745 ----
}
! if (xdr_double (((XDR *) current_stream), &x) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
***************
*** 753,757 ****
}
! if (xdr_vector (current_stream, (char *) x, len, sizeof (double),
(xdrproc_t) xdr_double) != TRUE)
{
--- 756,760 ----
}
! if (xdr_vector (((XDR *) current_stream), (char *) x, len, sizeof (double),
(xdrproc_t) xdr_double) != TRUE)
{
***************
*** 791,795 ****
! if (xdr_double (current_stream, &y) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
--- 794,798 ----
! if (xdr_double (((XDR *) current_stream), &y) != TRUE)
{
rcs_print_error ("CMS_XDR_UPDATER: xdr_double failed.\n");
***************
*** 828,832 ****
! if (xdr_vector (current_stream, (char *) y, len, sizeof (double),
(xdrproc_t) xdr_double) != TRUE)
{
--- 831,835 ----
! if (xdr_vector (((XDR *) current_stream), (char *) y, len, sizeof (double),
(xdrproc_t) xdr_double) != TRUE)
{
Index: cms_xup.hh
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/cms_xup.hh,v
retrieving revision 4.34
retrieving revision 4.34.2.1
diff -C2 -d -r4.34 -r4.34.2.1
*** cms_xup.hh 19 Mar 2003 09:38:44 -0000 4.34
--- cms_xup.hh 21 Aug 2003 20:24:14 -0000 4.34.2.1
***************
*** 1,24 ****
-
- #include "rcs_defs.hh" /* RCS_EXPORT */
-
-
#ifndef CMS_XUP_HH
#define CMS_XUP_HH
- extern "C"
- {
- #ifndef NO_DCE_RPC
- #include <rpc/rpc.h> /* struct XDR */
- #else
- #if defined(VXWORKS) || defined(irix6)
- #include <rpc/types.h>
- #include <rpc/xdr.h> // struct XDR
- #else
- #include "xdr.h"
- #endif
- #endif
-
- }
#include "cms_up.hh" /* class CMS_UPDATER */
--- 1,6 ----
***************
*** 58,68 ****
virtual ~ CMS_XDR_UPDATER ();
friend class RCS_EXPORT CMS;
! XDR *encode_data_stream; /* XDR streams for data */
! XDR *decode_data_stream;
! XDR *encode_header_stream; /* XDR streams for header */
! XDR *decode_header_stream;
! XDR *encode_queuing_header_stream; /* XDR streams for header */
! XDR *decode_queuing_header_stream;
! XDR *current_stream;
};
--- 40,50 ----
virtual ~ CMS_XDR_UPDATER ();
friend class RCS_EXPORT CMS;
! void *encode_data_stream; /* XDR streams for data */
! void *decode_data_stream;
! void *encode_header_stream; /* XDR streams for header */
! void *decode_header_stream;
! void *encode_queuing_header_stream; /* XDR streams for header */
! void *decode_queuing_header_stream;
! void *current_stream;
};
Index: http_srv.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/http_srv.cc,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** http_srv.cc 8 Aug 2003 14:21:10 -0000 1.2.2.1
--- http_srv.cc 21 Aug 2003 20:24:14 -0000 1.2.2.2
***************
*** 5,11 ****
****************************************************************************/
- #include "rcs_defs.hh" /* EXTERN_C_STD_HEADERS */
- #include "sokintrf.h" /* dl_ioctl() */
-
#if HAVE_CONFIG_H
--- 5,8 ----
***************
*** 13,74 ****
#else
!
! #ifdef EXTERN_C_STD_HEADERS
! extern "C"
! {
! #endif
!
! #include <string.h> /* memset(), strerror() */
! #include <stdlib.h> // malloc(), free()
! #include <sys/types.h>
! #include <sys/stat.h>
! #include <fcntl.h>
! #include <unistd.h>
! #include <dirent.h>
! #include <errno.h> /* errno */
! #include <signal.h> // SIGPIPE, signal()
!
! #if (defined(__CENTERLINE__) && !defined(VXWORKS)) || defined(sunos5) || defined(sparcworks)
! #include <sys/filio.h> /* FIONREAD */
! char *strerror (int errnum);
! char *dl_inet_ntoa (struct in_addr);
! #endif
!
! #ifdef EXTERN_C_STD_HEADERS
! }
! #endif
!
!
! #ifdef VXWORKS
! #include "vxWorks.h"
! #include "taskLib.h" // taskSpawn
! #endif
!
! #ifdef UNIX_LIKE_PLAT
! #include <sys/types.h>
! #include <sys/wait.h> // waitpid
! #endif
!
! #ifndef NO_THREADS
! #ifdef SGI
! #include <sys/resource.h>
! #include <sys/prctl.h> // sproc(), prctl()
! #endif
!
!
! #ifdef WIN32
! #ifdef MULTITHREADED
! #include <process.h> // _beginthread
! #else
! #define NO_THREADS
! #endif
! #endif
! #endif
!
#endif // HAVE_CONFIG_H
#include "cms.hh" /* class CMS */
- #include "nml.hh" // class NML
#include "http_srv.hh" /* class CMS_SERVER_REMOTE_HTTP_PORT */
#include "rcs_prnt.hh" /* rcs_print_error() */
--- 10,18 ----
#else
! #include "http_svr_no_config.h"
#endif // HAVE_CONFIG_H
#include "cms.hh" /* class CMS */
#include "http_srv.hh" /* class CMS_SERVER_REMOTE_HTTP_PORT */
#include "rcs_prnt.hh" /* rcs_print_error() */
***************
*** 78,81 ****
--- 22,27 ----
#include "_timer.h"
#include "cmsdiag.hh" // class CMS_DIAGNOSTICS_INFO
+ #include "sokintrf.h" /* dl_ioctl() */
+
extern "C"
***************
*** 85,88 ****
--- 31,77 ----
}
+ class CLIENT_HTTP_PORT
+ {
+ public:
+ CLIENT_HTTP_PORT ();
+ ~CLIENT_HTTP_PORT ();
+ long serial_number;
+ int errors, max_errors;
+ struct sockaddr_in * ptr_to_address;
+ int socket_fd;
+ RCS_LINKED_LIST *subscriptions;
+
+ int blocking;
+
+ // HTTPSVR_BLOCKING_READ_REQUEST *blocking_read_req;
+ char unprocessed_request[2048];
+ char *ptr_to_end_recieved_request;
+
+ REMOTE_SET_DIAG_INFO_REQUEST *diag_info;
+
+ #if defined(WIN32) && !defined(gnuwin32)
+ DWORD tid;
+ DWORD pid;
+ #else
+ #ifdef VXWORKS
+ int tid;
+ int pid;
+ #else
+ pid_t tid;
+ pid_t pid;
+ #endif
+ #endif
+ #if defined(sunos5) && !defined(NO_THREADS)
+ thread_t threadId;
+ #else
+ #ifdef POSIX_THREADS
+ pthread_t threadId;
+ #else
+ int threadId;
+ #endif
+ #endif
+
+ };
+
#ifdef HAVE_SNPRINTF
#define http_srv_safer_snprintf snprintf
***************
*** 205,212 ****
}
! memset (&server_socket_address, 0, sizeof (server_socket_address));
! server_socket_address.sin_family = AF_INET;
! server_socket_address.sin_addr.s_addr = dl_htonl (INADDR_ANY);
! server_socket_address.sin_port = 0;
client_ports = new RCS_LINKED_LIST;
--- 194,202 ----
}
! ptr_to_server_socket_address = new struct sockaddr_in;
! memset (ptr_to_server_socket_address, 0, sizeof (struct sockaddr_in));
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_family = AF_INET;
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_addr.s_addr = dl_htonl (INADDR_ANY);
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port = 0;
client_ports = new RCS_LINKED_LIST;
***************
*** 217,223 ****
}
polling_enabled = 0;
! memset (&select_timeout, 0, sizeof (select_timeout));
! select_timeout.tv_sec = 30;
! select_timeout.tv_usec = 30;
subscription_buffers = NULL;
current_poll_interval_millis = 30000;
--- 207,214 ----
}
polling_enabled = 0;
! ptr_to_select_timeout = new struct timeval;
! memset (ptr_to_select_timeout, 0, sizeof (struct timeval));
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = 30;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec = 30;
subscription_buffers = NULL;
current_poll_interval_millis = 30000;
***************
*** 234,237 ****
--- 225,238 ----
client_ports = (RCS_LINKED_LIST *) NULL;
}
+ if(ptr_to_server_socket_address)
+ {
+ free(ptr_to_server_socket_address);
+ ptr_to_server_socket_address=0;
+ }
+ if(ptr_to_select_timeout)
+ {
+ free(ptr_to_select_timeout);
+ ptr_to_select_timeout=0;
+ }
}
***************
*** 299,304 ****
while (NULL != client)
{
! rcs_print ("Exiting even though client on %s is still connected.\n",
! dl_inet_ntoa (client->address.sin_addr));
client = (CLIENT_HTTP_PORT *) client_ports->get_next ();
number_of_connected_clients++;
--- 300,308 ----
while (NULL != client)
{
! if( NULL != client->ptr_to_address)
! {
! rcs_print ("Exiting even though client on %s is still connected.\n",
! dl_inet_ntoa (((struct sockaddr_in*)client->ptr_to_address)->sin_addr));
! }
client = (CLIENT_HTTP_PORT *) client_ports->get_next ();
number_of_connected_clients++;
***************
*** 366,377 ****
max_total_subdivisions = _cms->total_subdivisions;
}
! if (server_socket_address.sin_port == 0)
{
! server_socket_address.sin_port =
dl_htons (((u_short) _cms->http_port_number));
port_num = _cms->http_port_number;
return 1;
}
! if (server_socket_address.sin_port ==
dl_htons (((u_short) _cms->http_port_number)))
{
--- 370,381 ----
max_total_subdivisions = _cms->total_subdivisions;
}
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port == 0)
{
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port =
dl_htons (((u_short) _cms->http_port_number));
port_num = _cms->http_port_number;
return 1;
}
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port ==
dl_htons (((u_short) _cms->http_port_number)))
{
***************
*** 388,393 ****
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"Registering server on HTTP port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
! if (server_socket_address.sin_port == 0)
{
rcs_print_error ("server can not register on port number 0.\n");
--- 392,397 ----
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"Registering server on HTTP port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port == 0)
{
rcs_print_error ("server can not register on port number 0.\n");
***************
*** 405,415 ****
return;
}
! if (dl_bind (connection_socket, (struct sockaddr *) &server_socket_address,
! sizeof (server_socket_address)) < 0)
{
rcs_print_error ("bind error: %d -- %s\n", errno, strerror (errno));
rcs_print_error
("Server can not bind the connection socket on port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
return;
}
--- 409,419 ----
return;
}
! if (dl_bind (connection_socket, (struct sockaddr *) ptr_to_server_socket_address,
! sizeof (struct sockaddr_in)) < 0)
{
rcs_print_error ("bind error: %d -- %s\n", errno, strerror (errno));
rcs_print_error
("Server can not bind the connection socket on port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
return;
}
***************
*** 418,422 ****
rcs_print_error ("listen error: %d -- %s\n", errno, strerror (errno));
rcs_print_error ("HTTP Server: error on call to listen for port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
return;
}
--- 422,426 ----
rcs_print_error ("listen error: %d -- %s\n", errno, strerror (errno));
rcs_print_error ("HTTP Server: error on call to listen for port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
return;
}
***************
*** 449,458 ****
RCS_FD_SET (connection_socket, &read_fd_set);
maxfdpl = connection_socket + 1;
! #ifndef DOS_WINDOWS
signal (SIGPIPE, handle_pipe_error);
#endif
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"running server for HTTP port %d (connection_socket = %d).\n",
! dl_ntohs (server_socket_address.sin_port),
connection_socket);
--- 453,462 ----
RCS_FD_SET (connection_socket, &read_fd_set);
maxfdpl = connection_socket + 1;
! #if !defined(DOS_WINDOWS) && !defined(WIN32)
signal (SIGPIPE, handle_pipe_error);
#endif
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"running server for HTTP port %d (connection_socket = %d).\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port),
connection_socket);
***************
*** 469,478 ****
memcpy (&read_fd_set_copy, &read_fd_set, sizeof (fd_set));
memcpy (&write_fd_set_copy, &write_fd_set, sizeof (fd_set));
! select_timeout.tv_sec = current_poll_interval_millis / 1000;
! select_timeout.tv_usec =
(current_poll_interval_millis % 1000) * 1000;
ready_descriptors =
dl_select (maxfdpl, &read_fd_set, &write_fd_set, (fd_set *) NULL,
! (timeval *) & select_timeout);
if (ready_descriptors == 0)
{
--- 473,482 ----
memcpy (&read_fd_set_copy, &read_fd_set, sizeof (fd_set));
memcpy (&write_fd_set_copy, &write_fd_set, sizeof (fd_set));
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = current_poll_interval_millis / 1000;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec =
(current_poll_interval_millis % 1000) * 1000;
ready_descriptors =
dl_select (maxfdpl, &read_fd_set, &write_fd_set, (fd_set *) NULL,
! (timeval *) ptr_to_select_timeout);
if (ready_descriptors == 0)
{
***************
*** 522,526 ****
"Socket closed by host with IP address %s.\n",
dl_inet_ntoa
! (client_port_to_check->address.sin_addr));
#if 0
if (NULL != client_port_to_check->subscriptions)
--- 526,530 ----
"Socket closed by host with IP address %s.\n",
dl_inet_ntoa
! (((struct sockaddr_in*)client_port_to_check->ptr_to_address)->sin_addr));
#if 0
if (NULL != client_port_to_check->subscriptions)
***************
*** 595,600 ****
"Data recieved from %s:%d when it should be blocking (bytes_ready=%d).\n",
dl_inet_ntoa
! (client_port_to_check->address.
! sin_addr),
client_port_to_check->socket_fd,
bytes_ready);
--- 599,603 ----
"Data recieved from %s:%d when it should be blocking (bytes_ready=%d).\n",
dl_inet_ntoa
! (((struct sockaddr_in*)client_port_to_check->ptr_to_address)->sin_addr),
client_port_to_check->socket_fd,
bytes_ready);
***************
*** 636,643 ****
int client_address_length;
new_client_port = new CLIENT_HTTP_PORT ();
! client_address_length = sizeof (new_client_port->address);
new_client_port->socket_fd = dl_accept (connection_socket,
(struct sockaddr *)
! &new_client_port->address,
&client_address_length);
current_clients++;
--- 639,646 ----
int client_address_length;
new_client_port = new CLIENT_HTTP_PORT ();
! client_address_length = sizeof (struct sockaddr_in);
new_client_port->socket_fd = dl_accept (connection_socket,
(struct sockaddr *)
! new_client_port->ptr_to_address,
&client_address_length);
current_clients++;
***************
*** 653,657 ****
rcs_print_debug (PRINT_SOCKET_CONNECT,
"Socket opened by host with IP address %s.\n",
! dl_inet_ntoa (new_client_port->address.sin_addr));
new_client_port->serial_number = 0;
new_client_port->blocking = 0;
--- 656,660 ----
rcs_print_debug (PRINT_SOCKET_CONNECT,
"Socket opened by host with IP address %s.\n",
! dl_inet_ntoa (((struct sockaddr_in*)new_client_port->ptr_to_address)->sin_addr));
new_client_port->serial_number = 0;
new_client_port->blocking = 0;
***************
*** 971,975 ****
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.sin_addr));
_client_http_port->errors++;
return;
--- 974,978 ----
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_addr));
_client_http_port->errors++;
return;
***************
*** 1131,1135 ****
_client_http_port->socket_fd;
server->read_req.clientid.long_id[1] =
! (long) _client_http_port->address.sin_port;
server->read_req.clientid.use_me = 0;
}
--- 1134,1138 ----
_client_http_port->socket_fd;
server->read_req.clientid.long_id[1] =
! (long) ((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_port;
server->read_req.clientid.use_me = 0;
}
***************
*** 1143,1149 ****
lp->cms->current_alias = 0;
server->read_req.clientid.long_id[0] = (long)
! _client_http_port->address.sin_addr.s_addr;
server->read_req.clientid.long_id[1] = (long)
! _client_http_port->address.sin_addr.s_addr;
server->read_req.clientid.use_me = 1;
}
--- 1146,1152 ----
lp->cms->current_alias = 0;
server->read_req.clientid.long_id[0] = (long)
! ((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_addr.s_addr;
server->read_req.clientid.long_id[1] = (long)
! ((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_addr.s_addr;
server->read_req.clientid.use_me = 1;
}
***************
*** 1169,1173 ****
server->read_req.clientid.
long_id[1] =
! (long) _client_http_port->address.
sin_port;
server->read_req.clientid.use_me =
--- 1172,1176 ----
server->read_req.clientid.
long_id[1] =
! (long) ((struct sockaddr_in*)_client_http_port->ptr_to_address)->
sin_port;
server->read_req.clientid.use_me =
***************
*** 1188,1192 ****
server->read_req.clientid.
long_id[1] =
! (long) _client_http_port->address.
sin_addr.s_addr;
server->read_req.clientid.use_me =
--- 1191,1195 ----
server->read_req.clientid.
long_id[1] =
! (long) ((struct sockaddr_in*)_client_http_port->ptr_to_address)->
sin_addr.s_addr;
server->read_req.clientid.use_me =
***************
*** 1286,1290 ****
char errmsg[4096];
sprintf (errmsg, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL %s was not found on this server.<P>\n<HR> <ADDRESS>Server at %s Port %ld</ADDRESS>\n</BODY></HTML>\n\n", uri,
! dl_inet_ntoa (server_socket_address.sin_addr), connection_port);
sendn (_client_http_port->socket_fd, errmsg, strlen (errmsg), 0, -1.0);
dl_closesocket (_client_http_port->socket_fd);
--- 1289,1293 ----
char errmsg[4096];
sprintf (errmsg, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL %s was not found on this server.<P>\n<HR> <ADDRESS>Server at %s Port %ld</ADDRESS>\n</BODY></HTML>\n\n", uri,
! dl_inet_ntoa (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_addr), connection_port);
sendn (_client_http_port->socket_fd, errmsg, strlen (errmsg), 0, -1.0);
dl_closesocket (_client_http_port->socket_fd);
***************
*** 1377,1381 ****
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.
sin_addr));
_client_http_port->errors++;
--- 1380,1384 ----
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->
sin_addr));
_client_http_port->errors++;
***************
*** 1686,1690 ****
("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.sin_addr));
_client_http_port->errors++;
return;
--- 1689,1693 ----
("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_addr));
_client_http_port->errors++;
return;
***************
*** 1702,1706 ****
("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.sin_addr));
_client_http_port->errors++;
return;
--- 1705,1709 ----
("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_addr));
_client_http_port->errors++;
return;
***************
*** 1896,1900 ****
server->read_req.clientid.long_id[0] = _client_http_port->socket_fd;
server->read_req.clientid.long_id[1] = (long)
! _client_http_port->address.sin_port;
server->read_req.clientid.use_me = 1;
--- 1899,1903 ----
server->read_req.clientid.long_id[0] = _client_http_port->socket_fd;
server->read_req.clientid.long_id[1] = (long)
! ((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_port;
server->read_req.clientid.use_me = 1;
***************
*** 1915,1919 ****
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.
sin_addr));
_client_http_port->errors++;
--- 1918,1922 ----
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->
sin_addr));
_client_http_port->errors++;
***************
*** 1986,1990 ****
server->write_req.clientid.long_id[0] = _client_http_port->socket_fd;
server->write_req.clientid.long_id[1] = (long)
! _client_http_port->address.sin_port;
server->write_req.clientid.use_me = 1;
--- 1989,1993 ----
server->write_req.clientid.long_id[0] = _client_http_port->socket_fd;
server->write_req.clientid.long_id[1] = (long)
! ((struct sockaddr_in*)_client_http_port->ptr_to_address)->sin_port;
server->write_req.clientid.use_me = 1;
***************
*** 2002,2006 ****
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (_client_http_port->address.
sin_addr));
_client_http_port->errors++;
--- 2005,2009 ----
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_http_port->socket_fd,
! dl_inet_ntoa (((struct sockaddr_in*)_client_http_port->ptr_to_address)->
sin_addr));
_client_http_port->errors++;
***************
*** 2526,2531 ****
current_poll_interval_millis = ((int) (clk_tck () * 1000.0));
}
! select_timeout.tv_sec = current_poll_interval_millis / 1000;
! select_timeout.tv_usec = (current_poll_interval_millis % 1000) * 1000;
dtimeout = (current_poll_interval_millis + 10) * 1000.0;
if (dtimeout < 0.5)
--- 2529,2534 ----
current_poll_interval_millis = ((int) (clk_tck () * 1000.0));
}
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = current_poll_interval_millis / 1000;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec = (current_poll_interval_millis % 1000) * 1000;
dtimeout = (current_poll_interval_millis + 10) * 1000.0;
if (dtimeout < 0.5)
***************
*** 2721,2732 ****
ptr_to_end_recieved_request = unprocessed_request;
max_errors = 50;
! address.sin_port = 0;
! address.sin_family = AF_INET;
! address.sin_addr.s_addr = dl_htonl (INADDR_ANY);
socket_fd = -1;
subscriptions = NULL;
tid = -1;
pid = -1;
! // blocking_read_req = NULL;
threadId = 0;
diag_info = NULL;
--- 2724,2741 ----
ptr_to_end_recieved_request = unprocessed_request;
max_errors = 50;
! ptr_to_address = new struct sockaddr_in;
! ((struct sockaddr_in*)ptr_to_address)->sin_port = 0;
! ((struct sockaddr_in*)ptr_to_address)->sin_family = AF_INET;
! ((struct sockaddr_in*)ptr_to_address)->sin_addr.s_addr = dl_htonl (INADDR_ANY);
socket_fd = -1;
subscriptions = NULL;
+
+ #ifndef WIN32
tid = -1;
pid = -1;
! #else
! tid = 0;
! pid = 0;
! #endif
threadId = 0;
diag_info = NULL;
***************
*** 2740,2743 ****
--- 2749,2758 ----
socket_fd = -1;
}
+ if(ptr_to_address)
+ {
+ free(ptr_to_address);
+ ptr_to_address = 0;
+ }
+
#if 0
if (NULL != subscriptions)
Index: http_srv.hh
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/http_srv.hh,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** http_srv.hh 8 Aug 2003 14:21:10 -0000 1.1.2.1
--- http_srv.hh 21 Aug 2003 20:24:14 -0000 1.1.2.2
***************
*** 5,50 ****
#include "cms_srv.hh" /* class CMS_SERVER_REMOTE_PORT */
#include "linklist.hh" /* class RCS_LINKED_LIST */
- #include "rcs_defs.hh" /* EXTERN_C_STD_HEADERS */
#include "sokintrf.h" // fd_set, sockaddr_in, timeval
#include "rem_msg.hh"
- #ifndef HAVE_CONFIG_H
-
- #ifdef EXTERN_C_STD_HEADERS
- extern "C"
- {
- #endif
-
- #include <string.h> /* memset(), strerror() */
- #include <errno.h> /* errno */
- #include <signal.h> // SIGPIPE, signal()
-
- #ifdef EXTERN_C_STD_HEADERS
- }
- #endif
-
- #ifndef NO_THREADS
- #ifdef sunos5
- #include <thread.h>
- #endif
-
- #ifdef linux
- #define NO_THREADS
- #endif
-
- #ifdef NO_THREADS
- #undef POSIX_THREADS
- #endif
-
- #ifdef POSIX_THREADS
- #include <pthread.h>
- #endif
-
- #endif
-
- #endif
-
- #include "dbg_mem.h" /* DEBUG_FREE,DEBUG_MALLOC,DEBUG_CALLOC */
-
#define MAX_HTTP_BUFFER_SIZE 16
class CLIENT_HTTP_PORT;
--- 5,11 ----
***************
*** 68,179 ****
int connection_socket;
long connection_port;
! struct sockaddr_in server_socket_address;
REMOTE_CMS_REQUEST *request;
char temp_buffer[0x2000];
int current_poll_interval_millis;
int polling_enabled;
! struct timeval select_timeout;
! #if 0
! void add_subscription_client (int buffer_number, int subscription_type,
! int poll_interval_millis,
! CLIENT_HTTP_PORT * clnt);
! void remove_subscription_client (CLIENT_HTTP_PORT * clnt,
! int buffer_number);
! void recalculate_polling_interval ();
! void update_subscriptions ();
! void switch_function (CLIENT_HTTP_PORT * _client_tcp_port,
! CMS_SERVER * server,
! long request_type,
! long buffer_number, long received_serial_number);
! #endif
!
! };
!
! #if 0
!
! class HTTP_BUFFER_SUBSCRIPTION_INFO
! {
! public:
! HTTP_BUFFER_SUBSCRIPTION_INFO ();
! ~HTTP_BUFFER_SUBSCRIPTION_INFO ();
! int buffer_number;
! int min_last_id;
! int list_id;
! RCS_LINKED_LIST *sub_clnt_info;
! };
!
! class HTTP_CLIENT_SUBSCRIPTION_INFO
! {
! public:
! HTTP_CLIENT_SUBSCRIPTION_INFO ();
! ~HTTP_CLIENT_SUBSCRIPTION_INFO ();
! int subscription_type;
! int poll_interval_millis;
! double last_sub_sent_time;
! int subscription_list_id;
! int buffer_number;
! int subscription_paused;
! int last_id_read;
! HTTP_BUFFER_SUBSCRIPTION_INFO *sub_buf_info;
! CLIENT_HTTP_PORT *clnt_port;
! };
!
! class HTTPSVR_BLOCKING_READ_REQUEST;
! #endif
!
! class CLIENT_HTTP_PORT
! {
! public:
! CLIENT_HTTP_PORT ();
! ~CLIENT_HTTP_PORT ();
! long serial_number;
! int errors, max_errors;
! struct sockaddr_in address;
! int socket_fd;
! RCS_LINKED_LIST *subscriptions;
! #if defined(WIN32) && !defined(gnuwin32)
! DWORD tid;
! DWORD pid;
! #else
! #ifdef VXWORKS
! int tid;
! int pid;
! #else
! pid_t tid;
! pid_t pid;
! #endif
! #endif
! int blocking;
! #if defined(sunos5) && !defined(NO_THREADS)
! thread_t threadId;
! #else
! #ifdef POSIX_THREADS
! pthread_t threadId;
! #else
! int threadId;
! #endif
! #endif
! // HTTPSVR_BLOCKING_READ_REQUEST *blocking_read_req;
! REMOTE_SET_DIAG_INFO_REQUEST *diag_info;
! char unprocessed_request[2048];
! char *ptr_to_end_recieved_request;
};
-
- #if 0
-
- class HTTPSVR_BLOCKING_READ_REQUEST:public REMOTE_BLOCKING_READ_REQUEST
- {
- public:
- HTTPSVR_BLOCKING_READ_REQUEST ();
- ~HTTPSVR_BLOCKING_READ_REQUEST ();
- CLIENT_HTTP_PORT *_client_http_port;
- CMS_SERVER_REMOTE_HTTP_PORT *remport;
- CMS_SERVER *server;
- REMOTE_BLOCKING_READ_REPLY *read_reply;
- };
-
- #endif
-
#endif /* HTTP_SRV_HH */
--- 29,40 ----
int connection_socket;
long connection_port;
! void * ptr_to_server_socket_address;
REMOTE_CMS_REQUEST *request;
char temp_buffer[0x2000];
int current_poll_interval_millis;
int polling_enabled;
! void * ptr_to_select_timeout;
};
#endif /* HTTP_SRV_HH */
Index: httpnml.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/Attic/httpnml.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** httpnml.cc 8 Aug 2003 14:48:05 -0000 1.1.2.1
--- httpnml.cc 21 Aug 2003 20:24:14 -0000 1.1.2.2
***************
*** 176,180 ****
EINPROGRESS == errno
#else
! #ifdef _Windows
WSAEWOULDBLOCK == dl_WSAGetLastError ()
#else
--- 176,180 ----
EINPROGRESS == errno
#else
! #if defined(_Windows) || defined(WIN32)
WSAEWOULDBLOCK == dl_WSAGetLastError ()
#else
***************
*** 188,192 ****
)
{
! #ifdef _Windows
tm.tv_sec = 0;
tm.tv_usec = 0;
--- 188,192 ----
)
{
! #if defined(_Windows) || defined(WIN32)
tm.tv_sec = 0;
tm.tv_usec = 0;
***************
*** 212,216 ****
return(0);
}
! #ifdef _Windows
tm.tv_sec = 0;
tm.tv_usec = 0;
--- 212,216 ----
return(0);
}
! #if defined(_Windows) || defined(WIN32)
tm.tv_sec = 0;
tm.tv_usec = 0;
***************
*** 220,224 ****
#endif
}
! #if defined(_Windows) && !defined(gnuwin32)
if (socket_ret == SOCKET_ERROR)
{
--- 220,224 ----
#endif
}
! #if defined(_Windows) || defined(WIN32) && !defined(gnuwin32)
if (socket_ret == SOCKET_ERROR)
{
***************
*** 239,243 ****
else
{
! #if defined(_Windows) && !defined(gnuwin32)
rcs_print_error ("connect error: %d\n", dl_WSAGetLastError ());
#else
--- 239,243 ----
else
{
! #if defined(_Windows) || defined(WIN32) && !defined(gnuwin32)
rcs_print_error ("connect error: %d\n", dl_WSAGetLastError ());
#else
Index: recvn.c
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/recvn.c,v
retrieving revision 4.36
retrieving revision 4.36.2.1
diff -C2 -d -r4.36 -r4.36.2.1
*** recvn.c 6 May 2003 15:18:15 -0000 4.36
--- recvn.c 21 Aug 2003 20:24:14 -0000 4.36.2.1
***************
*** 56,59 ****
--- 56,63 ----
int bytes_ready;
int bytes_to_read;
+ #if defined(WIN32) && !defined(gnuwin32)
+ unsigned long ioctlsocket_arg;
+ #endif
+
if (etime_disabled)
{
***************
*** 193,197 ****
bytes_ready = 0;
#if defined(WIN32) && !defined(gnuwin32)
! dl_ioctlsocket (fd, FIONREAD, &bytes_ready);
#else
#ifndef VXWORKS
--- 197,203 ----
bytes_ready = 0;
#if defined(WIN32) && !defined(gnuwin32)
! ioctlsocket_arg = 0;
! dl_ioctlsocket (fd, FIONREAD, &ioctlsocket_arg);
! bytes_ready = ((int) ioctlsocket_arg);
#else
#ifndef VXWORKS
***************
*** 217,221 ****
{
if (
! #if !defined(_WINDOWS) || defined(gnuwin32)
#ifdef MSDOS
(EWOULDBLOCK == (tk_geterrno (fd)))
--- 223,227 ----
{
if (
! #if ( !defined(_WINDOWS) && !defined(WIN32)) || defined(gnuwin32)
#ifdef MSDOS
(EWOULDBLOCK == (tk_geterrno (fd)))
Index: sendn.c
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/sendn.c,v
retrieving revision 4.35
retrieving revision 4.35.2.1
diff -C2 -d -r4.35 -r4.35.2.1
*** sendn.c 6 May 2003 15:18:16 -0000 4.35
--- sendn.c 21 Aug 2003 20:24:14 -0000 4.35.2.1
***************
*** 7,28 ****
*************************************************************************/
- /* This is neccessary to avoid muliple definitions of fd_set, etc when both
- * RPC via PCNFS and Windows Sockets are to be available. */
- #ifdef USE_PCNFS
- #undef USE_PCNFS
- #endif
- #include "rcs_defs.hh" /* _Windows */
! #if HAVE_CONFIG_H
#include "rcs_config_include.h"
#else
!
! #include <string.h> /* strerror */
! #include <stdlib.h> /* memset() */
!
! #include <errno.h> /* errno */
! #include <math.h> /* fabs() */
!
#endif
--- 7,16 ----
*************************************************************************/
! #ifdef HAVE_CONFIG_H
#include "rcs_config_include.h"
#else
! #include "sendn_no_config.h"
#endif
***************
*** 37,41 ****
/* Write "n" bytes to a descriptor. */
! int RCS_EXPORT
sendn (int fd, const void *vptr, int n, int _flags, double _timeout)
{
--- 25,29 ----
/* Write "n" bytes to a descriptor. */
! int
sendn (int fd, const void *vptr, int n, int _flags, double _timeout)
{
Index: sendn.h
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/sendn.h,v
retrieving revision 4.33
retrieving revision 4.33.2.1
diff -C2 -d -r4.33 -r4.33.2.1
*** sendn.h 6 May 2003 15:18:16 -0000 4.33
--- sendn.h 21 Aug 2003 20:24:14 -0000 4.33.2.1
***************
*** 7,16 ****
*************************************************************************/
!
!
! #ifndef WRITEN_H
! #define WRITEN_H
!
! #include "rcs_defs.hh" /* RCS_EXPORT */
#ifdef __cplusplus
--- 7,12 ----
*************************************************************************/
! #ifndef SENDN_H
! #define SENDN_H
#ifdef __cplusplus
***************
*** 19,26 ****
#endif
! #include <stddef.h> /* size_t */
!
! int RCS_EXPORT sendn (int fd, const void *vptr, int n, int flags,
! double timeout);
#ifdef __cplusplus
--- 15,19 ----
#endif
! int sendn (int fd, const void *vptr, int n, int flags, double timeout);
#ifdef __cplusplus
***************
*** 29,31 ****
! #endif /* WRITEN_H */
--- 22,24 ----
! #endif /* SENDN_H */
Index: sokintrf.h
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/sokintrf.h,v
retrieving revision 4.34.2.1
retrieving revision 4.34.2.2
diff -C2 -d -r4.34.2.1 -r4.34.2.2
*** sokintrf.h 8 Aug 2003 14:21:10 -0000 4.34.2.1
--- sokintrf.h 21 Aug 2003 20:24:14 -0000 4.34.2.2
***************
*** 22,26 ****
! #ifndef SOCKET_DEFINED
#define SOCKET_DEFINED
typedef unsigned int SOCKET;
--- 22,26 ----
! #if !defined(SOCKET_DEFINED) && !defined(HAVE_SOCKET_T) && !defined(HAVE_WINSOCK2_H)
#define SOCKET_DEFINED
typedef unsigned int SOCKET;
***************
*** 67,71 ****
char RCS_FAR * optval, int len);
int RCS_EXPORT dl_fd_isset (SOCKET s, fd_set RCS_FAR * set);
! #ifdef _WINDOWS
int RCS_EXPORT dl_WSAGetLastError (void);
#endif
--- 67,71 ----
char RCS_FAR * optval, int len);
int RCS_EXPORT dl_fd_isset (SOCKET s, fd_set RCS_FAR * set);
! #if defined(_WINDOWS) || defined(WIN32)
int RCS_EXPORT dl_WSAGetLastError (void);
#endif
Index: tcp_srv.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/tcp_srv.cc,v
retrieving revision 4.40.2.1
retrieving revision 4.40.2.2
diff -C2 -d -r4.40.2.1 -r4.40.2.2
*** tcp_srv.cc 8 Aug 2003 14:21:10 -0000 4.40.2.1
--- tcp_srv.cc 21 Aug 2003 20:24:14 -0000 4.40.2.2
***************
*** 5,11 ****
****************************************************************************/
- #include "rcs_defs.hh" /* EXTERN_C_STD_HEADERS */
- #include "sokintrf.h" /* dl_ioctl() */
-
#if HAVE_CONFIG_H
--- 5,8 ----
***************
*** 13,66 ****
#else
!
! #ifdef EXTERN_C_STD_HEADERS
! extern "C"
! {
! #endif
!
! #include <string.h> /* memset(), strerror() */
! #include <stdlib.h> // malloc(), free()
! #include <errno.h> /* errno */
! #include <signal.h> // SIGPIPE, signal()
!
! #if (defined(__CENTERLINE__) && !defined(VXWORKS)) || defined(sunos5) || defined(sparcworks)
! #include <sys/filio.h> /* FIONREAD */
! char *strerror (int errnum);
! char *dl_inet_ntoa (struct in_addr);
! #endif
!
! #ifdef EXTERN_C_STD_HEADERS
! }
! #endif
!
!
! #ifdef VXWORKS
! #include "vxWorks.h"
! #include "taskLib.h" // taskSpawn
! #endif
!
! #ifdef UNIX_LIKE_PLAT
! #include <sys/types.h>
! #include <sys/wait.h> // waitpid
! #endif
!
! #ifndef NO_THREADS
! #ifdef SGI
! #include <sys/resource.h>
! #include <sys/prctl.h> // sproc(), prctl()
! #endif
!
!
! #ifdef WIN32
! #ifdef MULTITHREADED
! #include <process.h> // _beginthread
! #else
! #define NO_THREADS
! #endif
! #endif
#endif
!
! #endif // HAVE_CONFIG_H
#include "cms.hh" /* class CMS */
--- 10,17 ----
#else
! #include "tcp_svr_no_config.h"
#endif
! #include "sokintrf.h" /* dl_ioctl() */
#include "cms.hh" /* class CMS */
***************
*** 80,83 ****
--- 31,87 ----
}
+ class TCPSVR_BLOCKING_READ_REQUEST;
+
+ class CLIENT_TCP_PORT
+ {
+ public:
+ CLIENT_TCP_PORT ();
+ ~CLIENT_TCP_PORT ();
+ long serial_number;
+ int errors, max_errors;
+ struct sockaddr_in address;
+ int socket_fd;
+ RCS_LINKED_LIST *subscriptions;
+
+ int blocking;
+
+ TCPSVR_BLOCKING_READ_REQUEST *blocking_read_req;
+ REMOTE_SET_DIAG_INFO_REQUEST *diag_info;
+ int blocking_read_in_progress;
+
+ #if defined(WIN32) && !defined(gnuwin32)
+ DWORD tid;
+ DWORD pid;
+ #else
+ #ifdef VXWORKS
+ int tid;
+ int pid;
+ #else
+ pid_t tid;
+ pid_t pid;
+ #endif
+ #endif
+ #if defined(sunos5) && !defined(NO_THREADS)
+ thread_t threadId;
+ #else
+ #ifdef POSIX_THREADS
+ pthread_t threadId;
+ #else
+ int threadId;
+ #endif
+ #endif
+ };
+
+ class TCPSVR_BLOCKING_READ_REQUEST:public REMOTE_BLOCKING_READ_REQUEST
+ {
+ public:
+ TCPSVR_BLOCKING_READ_REQUEST ();
+ ~TCPSVR_BLOCKING_READ_REQUEST ();
+ CLIENT_TCP_PORT *_client_tcp_port;
+ CMS_SERVER_REMOTE_TCP_PORT *remport;
+ CMS_SERVER *server;
+ REMOTE_BLOCKING_READ_REPLY *read_reply;
+ };
+
***************
*** 177,184 ****
}
! memset (&server_socket_address, 0, sizeof (server_socket_address));
! server_socket_address.sin_family = AF_INET;
! server_socket_address.sin_addr.s_addr = dl_htonl (INADDR_ANY);
! server_socket_address.sin_port = 0;
client_ports = new RCS_LINKED_LIST;
--- 181,190 ----
}
! ptr_to_server_socket_address = new struct sockaddr_in;
!
! memset (ptr_to_server_socket_address, 0, sizeof (struct sockaddr_in));
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_family = AF_INET;
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_addr.s_addr = dl_htonl (INADDR_ANY);
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port = 0;
client_ports = new RCS_LINKED_LIST;
***************
*** 189,195 ****
}
polling_enabled = 0;
! memset (&select_timeout, 0, sizeof (select_timeout));
! select_timeout.tv_sec = 30;
! select_timeout.tv_usec = 30;
subscription_buffers = NULL;
current_poll_interval_millis = 30000;
--- 195,202 ----
}
polling_enabled = 0;
! ptr_to_select_timeout = new struct timeval;
! memset (ptr_to_select_timeout, 0, sizeof (struct timeval));
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = 30;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec = 30;
subscription_buffers = NULL;
current_poll_interval_millis = 30000;
***************
*** 206,209 ****
--- 213,226 ----
client_ports = (RCS_LINKED_LIST *) NULL;
}
+ if(ptr_to_server_socket_address)
+ {
+ free(ptr_to_server_socket_address);
+ ptr_to_server_socket_address=0;
+ }
+ if(ptr_to_select_timeout)
+ {
+ free(ptr_to_select_timeout);
+ ptr_to_select_timeout=0;
+ }
}
***************
*** 241,245 ****
#endif
#ifdef WIN32
! TerminateThread ((HANDLE) id, -1);
#endif
tcpsvr_threads_killed++;
--- 258,262 ----
#endif
#ifdef WIN32
! TerminateThread ((HANDLE) id, 0);
#endif
tcpsvr_threads_killed++;
***************
*** 332,343 ****
max_total_subdivisions = _cms->total_subdivisions;
}
! if (server_socket_address.sin_port == 0)
{
! server_socket_address.sin_port =
dl_htons (((u_short) _cms->tcp_port_number));
port_num = _cms->tcp_port_number;
return 1;
}
! if (server_socket_address.sin_port ==
dl_htons (((u_short) _cms->tcp_port_number)))
{
--- 349,360 ----
max_total_subdivisions = _cms->total_subdivisions;
}
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port == 0)
{
! ((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port =
dl_htons (((u_short) _cms->tcp_port_number));
port_num = _cms->tcp_port_number;
return 1;
}
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port ==
dl_htons (((u_short) _cms->tcp_port_number)))
{
***************
*** 354,359 ****
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"Registering server on TCP port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
! if (server_socket_address.sin_port == 0)
{
rcs_print_error ("server can not register on port number 0.\n");
--- 371,376 ----
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"Registering server on TCP port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
! if (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port == 0)
{
rcs_print_error ("server can not register on port number 0.\n");
***************
*** 371,381 ****
return;
}
! if (dl_bind (connection_socket, (struct sockaddr *) &server_socket_address,
! sizeof (server_socket_address)) < 0)
{
rcs_print_error ("bind error: %d -- %s\n", errno, strerror (errno));
rcs_print_error
("Server can not bind the connection socket on port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
return;
}
--- 388,398 ----
return;
}
! if (dl_bind (connection_socket, (struct sockaddr *) ptr_to_server_socket_address,
! sizeof (struct sockaddr_in)) < 0)
{
rcs_print_error ("bind error: %d -- %s\n", errno, strerror (errno));
rcs_print_error
("Server can not bind the connection socket on port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
return;
}
***************
*** 384,388 ****
rcs_print_error ("listen error: %d -- %s\n", errno, strerror (errno));
rcs_print_error ("TCP Server: error on call to listen for port %d.\n",
! dl_ntohs (server_socket_address.sin_port));
return;
}
--- 401,405 ----
rcs_print_error ("listen error: %d -- %s\n", errno, strerror (errno));
rcs_print_error ("TCP Server: error on call to listen for port %d.\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port));
return;
}
***************
*** 415,424 ****
RCS_FD_SET (connection_socket, &read_fd_set);
maxfdpl = connection_socket + 1;
! #ifndef DOS_WINDOWS
signal (SIGPIPE, handle_pipe_error);
#endif
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"running server for TCP port %d (connection_socket = %d).\n",
! dl_ntohs (server_socket_address.sin_port),
connection_socket);
--- 432,441 ----
RCS_FD_SET (connection_socket, &read_fd_set);
maxfdpl = connection_socket + 1;
! #if !defined(DOS_WINDOWS) && !defined(WIN32)
signal (SIGPIPE, handle_pipe_error);
#endif
rcs_print_debug (PRINT_CMS_CONFIG_INFO,
"running server for TCP port %d (connection_socket = %d).\n",
! dl_ntohs (((struct sockaddr_in*)ptr_to_server_socket_address)->sin_port),
connection_socket);
***************
*** 435,444 ****
memcpy (&read_fd_set_copy, &read_fd_set, sizeof (fd_set));
memcpy (&write_fd_set_copy, &write_fd_set, sizeof (fd_set));
! select_timeout.tv_sec = current_poll_interval_millis / 1000;
! select_timeout.tv_usec =
(current_poll_interval_millis % 1000) * 1000;
ready_descriptors =
dl_select (maxfdpl, &read_fd_set, &write_fd_set, (fd_set *) NULL,
! (timeval *) & select_timeout);
if (ready_descriptors == 0)
{
--- 452,461 ----
memcpy (&read_fd_set_copy, &read_fd_set, sizeof (fd_set));
memcpy (&write_fd_set_copy, &write_fd_set, sizeof (fd_set));
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = current_poll_interval_millis / 1000;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec =
(current_poll_interval_millis % 1000) * 1000;
ready_descriptors =
dl_select (maxfdpl, &read_fd_set, &write_fd_set, (fd_set *) NULL,
! (timeval *) ptr_to_select_timeout);
if (ready_descriptors == 0)
{
***************
*** 537,545 ****
}
if (client_port_to_check->threadId > 0
! && client_port_to_check->blocking)
! {
! tcp_srv_blocking_thread_kill (client_port_to_check->
! threadId);
! }
dl_closesocket (client_port_to_check->socket_fd);
RCS_FD_CLR (client_port_to_check->socket_fd, &read_fd_set);
--- 554,562 ----
}
if (client_port_to_check->threadId > 0
! && client_port_to_check->blocking)
! {
! tcp_srv_blocking_thread_kill (client_port_to_check->
! threadId);
! }
dl_closesocket (client_port_to_check->socket_fd);
RCS_FD_CLR (client_port_to_check->socket_fd, &read_fd_set);
***************
*** 560,565 ****
"Data recieved from %s:%d when it should be blocking (bytes_ready=%d).\n",
dl_inet_ntoa
! (client_port_to_check->address.
! sin_addr),
client_port_to_check->socket_fd,
bytes_ready);
--- 577,581 ----
"Data recieved from %s:%d when it should be blocking (bytes_ready=%d).\n",
dl_inet_ntoa
! (client_port_to_check->address.sin_addr),
client_port_to_check->socket_fd,
bytes_ready);
***************
*** 602,606 ****
int client_address_length;
new_client_port = new CLIENT_TCP_PORT ();
! client_address_length = sizeof (new_client_port->address);
new_client_port->socket_fd = dl_accept (connection_socket,
(struct sockaddr *)
--- 618,622 ----
int client_address_length;
new_client_port = new CLIENT_TCP_PORT ();
! client_address_length = sizeof (struct sockaddr_in);
new_client_port->socket_fd = dl_accept (connection_socket,
(struct sockaddr *)
***************
*** 1626,1631 ****
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_tcp_port->socket_fd,
! dl_inet_ntoa (_client_tcp_port->address.
! sin_addr));
_client_tcp_port->errors++;
return;
--- 1642,1646 ----
rcs_print_error ("Can not read from client port (%d) from %s\n",
_client_tcp_port->socket_fd,
! dl_inet_ntoa (_client_tcp_port->address.sin_addr));
_client_tcp_port->errors++;
return;
***************
*** 2149,2154 ****
current_poll_interval_millis = ((int) (clk_tck () * 1000.0));
}
! select_timeout.tv_sec = current_poll_interval_millis / 1000;
! select_timeout.tv_usec = (current_poll_interval_millis % 1000) * 1000;
dtimeout = (current_poll_interval_millis + 10) * 1000.0;
if (dtimeout < 0.5)
--- 2164,2169 ----
current_poll_interval_millis = ((int) (clk_tck () * 1000.0));
}
! ((struct timeval*)ptr_to_select_timeout)->tv_sec = current_poll_interval_millis / 1000;
! ((struct timeval*)ptr_to_select_timeout)->tv_usec = (current_poll_interval_millis % 1000) * 1000;
dtimeout = (current_poll_interval_millis + 10) * 1000.0;
if (dtimeout < 0.5)
***************
*** 2344,2349 ****
--- 2359,2370 ----
socket_fd = -1;
subscriptions = NULL;
+ #ifndef WIN32
tid = -1;
pid = -1;
+ #else
+ tid = 0;
+ pid = 0;
+ #endif
+
blocking_read_req = NULL;
threadId = 0;
Index: tcp_srv.hh
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/tcp_srv.hh,v
retrieving revision 4.33.2.1
retrieving revision 4.33.2.2
diff -C2 -d -r4.33.2.1 -r4.33.2.2
*** tcp_srv.hh 8 Aug 2003 14:21:10 -0000 4.33.2.1
--- tcp_srv.hh 21 Aug 2003 20:24:14 -0000 4.33.2.2
***************
*** 5,50 ****
#include "cms_srv.hh" /* class CMS_SERVER_REMOTE_PORT */
#include "linklist.hh" /* class RCS_LINKED_LIST */
- #include "rcs_defs.hh" /* EXTERN_C_STD_HEADERS */
- #include "sokintrf.h" // fd_set, sockaddr_in, timeval
#include "rem_msg.hh"
- #ifndef HAVE_CONFIG_H
-
- #ifdef EXTERN_C_STD_HEADERS
- extern "C"
- {
- #endif
-
- #include <string.h> /* memset(), strerror() */
- #include <errno.h> /* errno */
- #include <signal.h> // SIGPIPE, signal()
-
- #ifdef EXTERN_C_STD_HEADERS
- }
- #endif
-
- #ifndef NO_THREADS
- #ifdef sunos5
- #include <thread.h>
- #endif
-
- #ifdef linux
- #defin...
[truncated message content] |