X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcsockconn.h;h=ea47d3da1e0b716847b88c90fdf404aea3e7a018;hb=a818c5b5411bbc4436d1c5f011236985c96bb787;hp=dafda0c6f835639ed3b6bf0c4f0ba7517c19cd5a;hpb=72e3a28c7398a56d25433bcbbd1e54576777f802;p=silc.git diff --git a/lib/silcutil/silcsockconn.h b/lib/silcutil/silcsockconn.h index dafda0c6..ea47d3da 100644 --- a/lib/silcutil/silcsockconn.h +++ b/lib/silcutil/silcsockconn.h @@ -2,8 +2,6 @@ silcsockconn.h - COPYRIGHT - Author: Pekka Riikonen Copyright (C) 1997 - 2001 Pekka Riikonen @@ -20,7 +18,7 @@ */ -/****h* silcutil/silcsockconn.h +/****h* silcutil/SilcSocketConnectionAPI * * DESCRIPTION * @@ -96,11 +94,13 @@ typedef enum { /* Socket flags */ #define SILC_SF_NONE 0 -#define SILC_SF_INBUF_PENDING 1 -#define SILC_SF_OUTBUF_PENDING 2 -#define SILC_SF_DISCONNECTING 3 -#define SILC_SF_DISCONNECTED 4 -#define SILC_SF_HOST_LOOKUP 5 +#define SILC_SF_INBUF_PENDING 1 /* data in inbound buffer */ +#define SILC_SF_OUTBUF_PENDING 2 /* data in outbound buffer */ +#define SILC_SF_DISCONNECTING 3 /* socket disconnecting */ +#define SILC_SF_DISCONNECTED 4 /* socket disconnected */ +#define SILC_SF_HOST_LOOKUP 5 /* performing host lookup for socket */ +#define SILC_SF_DISABLED 6 /* socket connection is disabled, + no data is sent or received. */ /****s* silcutil/SilcSocketConnectionAPI/SilcSocketConnectionStruct * @@ -142,7 +142,7 @@ typedef enum { * Protocol object for the socket. Currently only one protocol can be * executing at a time for a particular socket. * - * uint32 flags + * SilcUInt32 flags * * Socket flags that indicate the status of the socket. This can * indicate several different status that can affect the use of the @@ -155,7 +155,7 @@ typedef enum { * * char *hostname * char *ip - * uint16 port + * SilcUInt16 port * * Resolved hostname, IP address and port of the connection who owns * this object. @@ -178,12 +178,13 @@ struct SilcSocketConnectionStruct { SilcSocketType type; void *user_data; SilcProtocol protocol; - uint32 flags; + SilcUInt32 flags; + SilcUInt8 sock_error; int users; char *hostname; char *ip; - uint16 port; + SilcUInt16 port; SilcBuffer inbuf; SilcBuffer outbuf; @@ -210,11 +211,13 @@ struct SilcSocketConnectionStruct { #define SILC_SET_DISCONNECTING(x) SF_SET((x), SILC_SF_DISCONNECTING) #define SILC_SET_DISCONNECTED(x) SF_SET((x), SILC_SF_DISCONNECTED) #define SILC_SET_HOST_LOOKUP(x) SF_SET((x), SILC_SF_HOST_LOOKUP) +#define SILC_SET_DISABLED(x) SF_SET((x), SILC_SF_HOST_LOOKUP) #define SILC_UNSET_OUTBUF_PENDING(x) SF_UNSET((x), SILC_SF_OUTBUF_PENDING) #define SILC_UNSET_INBUF_PENDING(x) SF_UNSET((x), SILC_SF_INBUF_PENDING) #define SILC_UNSET_DISCONNECTING(x) SF_UNSET((x), SILC_SF_DISCONNECTING) #define SILC_UNSET_DISCONNECTED(x) SF_UNSET((x), SILC_SF_DISCONNECTED) #define SILC_UNSET_HOST_LOOKUP(x) SF_UNSET((x), SILC_SF_HOST_LOOKUP) +#define SILC_UNSET_DISABLED(x) SF_UNSET((x), SILC_SF_DISABLED) /* Checking for flags */ #define SILC_IS_OUTBUF_PENDING(x) SF_IS((x), SILC_SF_OUTBUF_PENDING) @@ -222,6 +225,7 @@ struct SilcSocketConnectionStruct { #define SILC_IS_DISCONNECTING(x) SF_IS((x), SILC_SF_DISCONNECTING) #define SILC_IS_DISCONNECTED(x) SF_IS((x), SILC_SF_DISCONNECTED) #define SILC_IS_HOST_LOOKUP(x) SF_IS((x), SILC_SF_HOST_LOOKUP) +#define SILC_IS_DISABLED(x) SF_IS((x), SILC_SF_DISABLED) /* Prototypes */ @@ -296,7 +300,7 @@ int silc_socket_read(SilcSocketConnection sock); * * SYNOPSIS * - * int silc_socket_read(SilcSocketConnection sock); + * int silc_socket_write(SilcSocketConnection sock); * * DESCRIPTION * @@ -310,6 +314,23 @@ int silc_socket_read(SilcSocketConnection sock); ***/ int silc_socket_write(SilcSocketConnection sock); +/****f* silcutil/SilcSocketConnectionAPI/silc_socket_get_error + * + * SYNOPSIS + * + * bool silc_socket_get_error(SilcSocketConnection sock, char *error, + * SilcUInt32 error_len); + * + * DESCRIPTION + * + * Returns human readable error message into the `error' buffer if + * the socket is in error status. Returns TRUE if error message was + * written into the buffer and FALSE if there is not socket error. + * + ***/ +bool silc_socket_get_error(SilcSocketConnection sock, char *error, + SilcUInt32 error_len); + /****f* silcutil/SilcSocketConnectionAPI/SilcSocketConnectionHBCb * * SYNOPSIS @@ -332,7 +353,7 @@ typedef void (*SilcSocketConnectionHBCb)(SilcSocketConnection sock, * SYNOPSIS * * void silc_socket_set_heartbeat(SilcSocketConnection sock, - * uint32 heartbeat, + * SilcUInt32 heartbeat, * void *hb_context, * SilcSocketConnectionHBCb hb_callback, * SilcSchedule schedule); @@ -349,7 +370,7 @@ typedef void (*SilcSocketConnectionHBCb)(SilcSocketConnection sock, * ***/ void silc_socket_set_heartbeat(SilcSocketConnection sock, - uint32 heartbeat, + SilcUInt32 heartbeat, void *hb_context, SilcSocketConnectionHBCb hb_callback, SilcSchedule schedule);