5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2005 - 2006 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 #ifndef SILCSOCKETSTREAM_I_H
21 #define SILCSOCKETSTREAM_I_H
23 #ifndef SILCSOCKETSTREAM_H
24 #error "Do not include this header directly"
27 typedef struct SilcSocketStreamStruct *SilcSocketStream;
30 typedef struct SilcSocketQosStruct {
31 SilcUInt16 read_limit_bytes; /* Max read bytes */
32 SilcUInt16 read_rate; /* Max read rate/second */
33 SilcUInt16 limit_sec; /* Limit seconds */
34 SilcUInt32 limit_usec; /* Limit microseconds */
35 struct timeval next_limit;
36 unsigned int cur_rate : 31;
37 unsigned int applied : 1;
39 unsigned char *buffer;
40 SilcSocketStream sock;
43 /* SILC Socket Stream context */
44 struct SilcSocketStreamStruct {
45 const SilcStreamOps *ops;
46 SilcSchedule schedule;
51 SilcUInt16 sock_error;
53 SilcStreamNotifier notifier;
54 void *notifier_context;
55 unsigned int ipv6 : 1; /* UDP IPv6 */
56 unsigned int connected : 1; /* UDP connected state */
59 #define SILC_IS_SOCKET_STREAM(s) (s->ops == &silc_socket_stream_ops)
60 #define SILC_IS_SOCKET_STREAM_UDP(s) (s->ops == &silc_socket_udp_stream_ops)
62 extern const SilcStreamOps silc_socket_stream_ops;
63 extern const SilcStreamOps silc_socket_udp_stream_ops;
65 #endif /* SILCSOCKETSTREAM_I_H */