[ds6-devel] nc6/src connection.h,1.9,1.10 parser.c,1.29,1.30
chris at deepspace6.net
chris at deepspace6.net
Sat Jan 4 00:25:21 CET 2003
Update of /cvs/nc6/src
Modified Files:
connection.h parser.c
Log Message:
Replaced parse_and_set_timeouts with parse_int_pair and moved handling of
setting timeouts back into the main parser function.
Index: connection.h
===================================================================
RCS file: /cvs/nc6/src/connection.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- connection.h 3 Jan 2003 09:30:20 -0000 1.9
+++ connection.h 3 Jan 2003 23:25:19 -0000 1.10
@@ -76,10 +76,10 @@
#define ca_suppress_half_close_local(CA) \
ios_suppress_half_close(&((CA)->local_stream), FALSE)
-#define ca_set_hold_timeout_remote(CA) \
- ios_set_hold_timeout(&((CA)->remote_stream), -1)
-#define ca_set_hold_timeout_local(CA) \
- ios_set_hold_timeout(&((CA)->local_stream), -1)
+#define ca_set_hold_timeout_remote(CA, T) \
+ ios_set_hold_timeout(&((CA)->remote_stream), (T))
+#define ca_set_hold_timeout_local(CA, T) \
+ ios_set_hold_timeout(&((CA)->local_stream), (T))
#define ca_resize_local_buf(CA, SIZE) cb_resize(&((CA)->local_buffer),(SIZE))
#define ca_resize_remote_buf(CA, SIZE) cb_resize(&((CA)->remote_buffer),(SIZE))
Index: parser.c
===================================================================
RCS file: /cvs/nc6/src/parser.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- parser.c 3 Jan 2003 09:30:20 -0000 1.29
+++ parser.c 3 Jan 2003 23:25:19 -0000 1.30
@@ -89,41 +89,43 @@
static void set_flag(unsigned long mask);
static void unset_flag(unsigned long mask);
-static void parse_and_set_timeouts(const char *str,
- connection_attributes *attrs);
+static int parse_int_pair(const char *str, int *first, int *second);
static void print_usage(FILE *fp);
int parse_arguments(int argc, char **argv, connection_attributes *attrs)
{
int c, ret = -1, verbosity_level = 0;
+ int option_index = 0;
+
+ /* configurable parameters and default values */
+ sock_family family = PROTO_UNSPECIFIED;
+ sock_protocol protocol = TCP_PROTOCOL;
+ address local_address, remote_address;
bool listen_mode = FALSE;
bool file_transfer = FALSE;
+ bool half_close = FALSE;
+ int connect_timeout = -1;
+ bool set_local_hold_timeout = FALSE;
+ int local_hold_timeout;
+ bool set_remote_hold_timeout = FALSE;
+ int remote_hold_timeout;
size_t remote_mtu = 0;
size_t remote_nru = 0;
size_t remote_buffer_size = 0;
size_t local_buffer_size = 0;
- int option_index = 0;
- sock_family family;
- sock_protocol protocol;
- int connect_timeout = -1;
- address local_address, remote_address;
- bool half_close = FALSE;
/* initialize the addresses of the connection endpoints */
address_init(&remote_address);
address_init(&local_address);
- /* set socket types to default values */
- family = PROTO_UNSPECIFIED;
- protocol = TCP_PROTOCOL;
-
/* option recognition loop */
while ((c = getopt_long(argc, argv, "46hlnp:q:s:uvw:x",
- long_options, &option_index)) >= 0) {
- switch(c) {
+ long_options, &option_index)) >= 0)
+ {
+ switch (c) {
case 0:
- switch(option_index) {
+ switch (option_index) {
case OPT_RECV_ONLY:
set_flag(RECV_DATA_ONLY);
break;
@@ -182,8 +184,12 @@
break;
case 'q':
assert(optarg != NULL);
- /* TODO: clean this code before release!!! */
- parse_and_set_timeouts(optarg, attrs);
+ switch (parse_int_pair(optarg, &local_hold_timeout,
+ &remote_hold_timeout))
+ {
+ case 2: set_remote_hold_timeout = TRUE;
+ case 1: set_local_hold_timeout = TRUE;
+ };
break;
case 's':
assert(optarg != NULL);
@@ -254,12 +260,13 @@
/* check to make sure the user wasn't silly enough to set both
* --recv-only and --send-only */
if (is_flag_set(RECV_DATA_ONLY) == TRUE &&
- is_flag_set(SEND_DATA_ONLY) == TRUE) {
+ is_flag_set(SEND_DATA_ONLY) == TRUE)
+ {
fatal("Cannot set both --recv-only and --send-only");
}
/* additional arguments are the remote address/service */
- switch(argc) {
+ switch (argc) {
case 0:
remote_address.address = NULL;
remote_address.service = NULL;
@@ -301,7 +308,8 @@
}
[...60 lines suppressed...]
More information about the ds6-devel
mailing list