diff options
author | Linus Nordberg <linus@nordu.net> | 2011-03-08 13:37:46 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-03-08 14:23:37 +0100 |
commit | d464ebb9235fe78e6588e95d4d3333d5ee95ca48 (patch) | |
tree | c1a35006abc218813b4425edea4c79bbd3763766 /lib/include | |
parent | 657eec7ee5a276521eb456bf648878935e794b6e (diff) |
Timeout implemented in request objects, supported by TCP.
TODO: UDP.
Diffstat (limited to 'lib/include')
-rw-r--r-- | lib/include/radsec/radsec-impl.h | 1 | ||||
-rw-r--r-- | lib/include/radsec/radsec.h | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h index a924fc9..49f9a35 100644 --- a/lib/include/radsec/radsec-impl.h +++ b/lib/include/radsec/radsec-impl.h @@ -75,6 +75,7 @@ struct rs_connection { struct rs_peer *peers; struct rs_peer *active_peer; struct rs_error *err; + struct timeval timeout; char is_connecting; /* FIXME: replace with a single state member */ char is_connected; /* FIXME: replace with a single state member */ int fd; /* Socket. */ diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h index fcd391d..5f8f4db 100644 --- a/lib/include/radsec/radsec.h +++ b/lib/include/radsec/radsec.h @@ -3,6 +3,7 @@ /* See the file COPYING for licensing information. */ #include <unistd.h> +#include <sys/time.h> enum rs_err_code { RSE_OK = 0, @@ -21,9 +22,10 @@ enum rs_err_code { RSE_INTERNAL = 13, RSE_SSLERR = 14, /* OpenSSL error. */ RSE_INVALID_PKT = 15, - RSE_TIMEOUT_CONN = 16, - RSE_INVAL = 17, - RSE_TIMEOUT_IO = 18, + RSE_TIMEOUT_CONN = 16, /* Connection timeout. */ + RSE_INVAL = 17, /* Invalid argument. */ + RSE_TIMEOUT_IO = 18, /* I/O timeout. */ + RSE_TIMEOUT = 19, /* High level timeout. */ }; enum rs_conn_type { @@ -111,6 +113,7 @@ int rs_conn_receive_packet(struct rs_connection *conn, struct rs_packet *request, struct rs_packet **pkt_out); int rs_conn_fd(struct rs_connection *conn); +void rs_conn_set_timeout(struct rs_connection *conn, struct timeval *tv); /* Peer -- client and server. */ int rs_peer_create(struct rs_connection *conn, struct rs_peer **peer_out); |