Added preliminary Symbian support.
[silc.git] / lib / silcutil / silcsocketstream_i.h
1 /*
2
3   silcsocketstream_i.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2005 - 2006 Pekka Riikonen
8
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.
12
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.
17
18 */
19
20 #ifndef SILCSOCKETSTREAM_I_H
21 #define SILCSOCKETSTREAM_I_H
22
23 #ifndef SILCSOCKETSTREAM_H
24 #error "Do not include this header directly"
25 #endif
26
27 typedef struct SilcSocketStreamStruct *SilcSocketStream;
28
29 /* Qos context */
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;
38   SilcUInt32 data_len;
39   unsigned char *buffer;
40   SilcSocketStream sock;
41 } *SilcSocketQos;
42
43 /* SILC Socket Stream context */
44 struct SilcSocketStreamStruct {
45   const SilcStreamOps *ops;
46   SilcSchedule schedule;
47   SilcSocket sock;
48   char *hostname;
49   char *ip;
50   SilcUInt16 port;
51   SilcUInt16 sock_error;
52   SilcSocketQos qos;
53   SilcStreamNotifier notifier;
54   void *notifier_context;
55   unsigned int ipv6      : 1;       /* UDP IPv6 */
56   unsigned int connected : 1;       /* UDP connected state */
57 };
58
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)
61
62 extern const SilcStreamOps silc_socket_stream_ops;
63 extern const SilcStreamOps silc_socket_udp_stream_ops;
64
65 #endif /* SILCSOCKETSTREAM_I_H */