diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-01-15 06:48:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-01-15 06:48:09 +0800 |
commit | 24a2d4baa8137fa990fff01b8e751538311d4de2 (patch) | |
tree | 9c6f87eac22ceed5b818425ef4598f0804373f54 /camel/camel-tcp-stream.h | |
parent | 80b2b2222ea67c50e0e3f9fdeb1797fb7874f862 (diff) | |
download | gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.tar.gz gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.tar.zst gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.zip |
Implemented. (stream_setsockopt): Implemented.
2001-01-14 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-ssl.c (stream_getsockopt): Implemented.
(stream_setsockopt): Implemented.
* camel-tcp-stream-raw.c (stream_getsockopt): Implemented.
(stream_setsockopt): Implemented.
* camel-tcp-stream.c (camel_tcp_stream_getsockopt): New method.
(camel_tcp_stream_setsockopt): Another new method. I think you get
the idea of what these are for so I won't explain them.
svn path=/trunk/; revision=7491
Diffstat (limited to 'camel/camel-tcp-stream.h')
-rw-r--r-- | camel/camel-tcp-stream.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h index 35eae89663..63ad6e7ec4 100644 --- a/camel/camel-tcp-stream.h +++ b/camel/camel-tcp-stream.h @@ -34,6 +34,7 @@ extern "C" { #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> +#include <netinet/tcp.h> #include <unistd.h> #define CAMEL_TCP_STREAM_TYPE (camel_tcp_stream_get_type ()) @@ -41,6 +42,50 @@ extern "C" { #define CAMEL_TCP_STREAM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TCP_STREAM_TYPE, CamelTcpStreamClass)) #define CAMEL_IS_TCP_STREAM(o) (CAMEL_CHECK_TYPE((o), CAMEL_TCP_STREAM_TYPE)) +typedef enum { + CAMEL_SOCKOPT_NONBLOCKING, /* nonblocking io */ + CAMEL_SOCKOPT_LINGER, /* linger on close if data present */ + CAMEL_SOCKOPT_REUSEADDR, /* allow local address reuse */ + CAMEL_SOCKOPT_KEEPALIVE, /* keep connections alive */ + CAMEL_SOCKOPT_RECVBUFFERSIZE, /* receive buffer size */ + CAMEL_SOCKOPT_SENDBUFFERSIZE, /* send buffer size */ + + CAMEL_SOCKOPT_IPTIMETOLIVE, /* time to live */ + CAMEL_SOCKOPT_IPTYPEOFSERVICE, /* type of service and precedence */ + + CAMEL_SOCKOPT_ADDMEMBER, /* add an IP group membership */ + CAMEL_SOCKOPT_DROPMEMBER, /* drop an IP group membership */ + CAMEL_SOCKOPT_MCASTINTERFACE, /* multicast interface address */ + CAMEL_SOCKOPT_MCASTTIMETOLIVE, /* multicast timetolive */ + CAMEL_SOCKOPT_MCASTLOOPBACK, /* multicast loopback */ + + CAMEL_SOCKOPT_NODELAY, /* don't delay send to coalesce packets */ + CAMEL_SOCKOPT_MAXSEGMENT, /* maximum segment size */ + CAMEL_SOCKOPT_BROADCAST, /* enable broadcast */ + CAMEL_SOCKOPT_LAST +} CamelSockOpt; + +typedef struct linger CamelLinger; + +typedef struct _CamelSockOptData { + CamelSockOpt option; + union { + guint ip_ttl; /* IP time to live */ + guint mcast_ttl; /* IP multicast time to live */ + guint tos; /* IP type of service and precedence */ + gboolean non_blocking; /* Non-blocking (network) I/O */ + gboolean reuse_addr; /* Allow local address reuse */ + gboolean keep_alive; /* Keep connections alive */ + gboolean mcast_loopback; /* IP multicast loopback */ + gboolean no_delay; /* Don't delay send to coalesce packets */ + gboolean broadcast; /* Enable broadcast */ + size_t max_segment; /* Maximum segment size */ + size_t recv_buffer_size; /* Receive buffer size */ + size_t send_buffer_size; /* Send buffer size */ + CamelLinger linger; /* Time to linger on close if data present */ + } value; +} CamelSockOptData; + struct _CamelTcpStream { CamelStream parent_object; @@ -53,6 +98,8 @@ typedef struct { /* Virtual methods */ int (*connect) (CamelTcpStream *stream, struct hostent *host, int port); int (*disconnect) (CamelTcpStream *stream); + int (*getsockopt) (CamelTcpStream *stream, CamelSockOptData *data); + int (*setsockopt) (CamelTcpStream *stream, const CamelSockOptData *data); } CamelTcpStreamClass; @@ -62,6 +109,8 @@ CamelType camel_tcp_stream_get_type (void); /* public methods */ int camel_tcp_stream_connect (CamelTcpStream *stream, struct hostent *host, int port); int camel_tcp_stream_disconnect (CamelTcpStream *stream); +int camel_tcp_stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data); +int camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data); #ifdef __cplusplus } |