X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcsocketstream_i.h;h=894c4b1e581299b8256af05d9caf0b2ece04c312;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=46c5ef2921ab8ed2c8db94515e5ce51ebbb7f601;hpb=c14dc73816933bb82e63a2ffbc90eaca9c9895d3;p=silc.git diff --git a/lib/silcutil/silcsocketstream_i.h b/lib/silcutil/silcsocketstream_i.h index 46c5ef29..894c4b1e 100644 --- a/lib/silcutil/silcsocketstream_i.h +++ b/lib/silcutil/silcsocketstream_i.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2005 - 2006 Pekka Riikonen + Copyright (C) 2005 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,15 +44,30 @@ typedef struct SilcSocketQosStruct { struct SilcSocketStreamStruct { const SilcStreamOps *ops; SilcSchedule schedule; - int sock; + SilcSocket sock; char *hostname; char *ip; - SilcUInt16 port; - SilcUInt16 sock_error; SilcSocketQos qos; SilcStreamNotifier notifier; void *notifier_context; - unsigned int ipv6 : 1; + SilcUInt16 port; + unsigned int ipv6 : 1; /* UDP IPv6 */ + unsigned int connected : 1; /* UDP connected state */ }; +#define SILC_IS_SOCKET_STREAM(s) (s->ops == &silc_socket_stream_ops) +#define SILC_IS_SOCKET_STREAM_UDP(s) (s->ops == &silc_socket_udp_stream_ops) + +extern const SilcStreamOps silc_socket_stream_ops; +extern const SilcStreamOps silc_socket_udp_stream_ops; + +/* Backwards support */ +#define SilcSocketStreamStatus SilcResult +#define silc_socket_stream_get_error(stream) silc_errno +#define SILC_SOCKET_OK SILC_OK +#define SILC_SOCKET_UNKNOWN_IP SILC_ERR_UNKNOWN_IP +#define SILC_SOCKET_UNKNOWN_HOST SILC_ERR_UNKNOWN_HOST +#define SILC_SOCKET_NO_MEMORY SILC_ERR_OUT_OF_MEMORY +#define SILC_SOCKET_ERROR SILC_ERR + #endif /* SILCSOCKETSTREAM_I_H */