CamelTcpStream

CamelTcpStream

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── CamelObject
        ╰── CamelStream
            ╰── CamelTcpStream
                ╰── CamelTcpStreamRaw

Description

Functions

camel_tcp_stream_connect ()

gint
camel_tcp_stream_connect (CamelTcpStream *stream,
                          const gchar *host,
                          const gchar *service,
                          gint fallback_port,
                          GCancellable *cancellable,
                          GError **error);

Create a socket and connect based upon the data provided.

Parameters

stream

a CamelTcpStream object

 

host

Hostname for connection

 

service

Service name or port number in string form

 

fallback_port

Port number to retry if service is not present in the system's services database, or 0 to avoid retrying

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

0 on success or -1 on fail


camel_tcp_stream_getsockopt ()

gint
camel_tcp_stream_getsockopt (CamelTcpStream *stream,
                             CamelSockOptData *data);

Get the socket options set on the stream and populate data .

Parameters

stream

a CamelTcpStream object

 

data

socket option data

 

Returns

0 on success or -1 on fail


camel_tcp_stream_setsockopt ()

gint
camel_tcp_stream_setsockopt (CamelTcpStream *stream,
                             const CamelSockOptData *data);

Set the socket options contained in data on the stream.

Parameters

stream

a CamelTcpStream object

 

data

socket option data

 

Returns

0 on success or -1 on fail


camel_tcp_stream_get_file_desc ()

PRFileDesc *
camel_tcp_stream_get_file_desc (CamelTcpStream *stream);

Parameters

stream

a CamelTcpStream

 

Since 2.32


camel_tcp_stream_set_socks_proxy ()

void
camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream,
                                  const gchar *socks_host,
                                  gint socks_port);

Configures a SOCKS proxy for the specified stream . Instead of direct connections, this stream will instead go through the proxy.

Parameters

stream

a CamelTcpStream object

 

socks_host

hostname to use for the SOCKS proxy

 

socks_port

port number to use for the SOCKS proxy

 

Since 2.32


camel_tcp_stream_peek_socks_proxy ()

void
camel_tcp_stream_peek_socks_proxy (CamelTcpStream *stream,
                                   const gchar **socks_host_ret,
                                   gint *socks_port_ret);

Queries the SOCKS proxy that is configured for a stream . This will return NULL in socks_host_ret if no proxy is configured.

Parameters

stream

a CamelTcpStream

 

socks_host_ret

location to return the name of the SOCKS host

 

socks_port_ret

location to return the port number in the SOCKS host

 

Since 2.32


camel_tcp_stream_get_local_address ()

struct sockaddr *
camel_tcp_stream_get_local_address (CamelTcpStream *stream,
                                    socklen_t *len);

Get the local address of stream .

Parameters

stream

a CamelTcpStream object

 

len

pointer to address length which must be supplied

 

Returns

the stream's local address (which must be freed with g_free()) if the stream is connected, or NULL if not

Since 2.22


camel_tcp_stream_get_remote_address ()

struct sockaddr *
camel_tcp_stream_get_remote_address (CamelTcpStream *stream,
                                     socklen_t *len);

Get the remote address of stream .

Parameters

stream

a CamelTcpStream object

 

len

pointer to address length, which must be supplied

 

Returns

the stream's remote address (which must be freed with g_free()) if the stream is connected, or NULL if not.

Since 2.22

Types and Values

struct CamelTcpStream

struct CamelTcpStream;

enum CamelSockOpt

Members

CAMEL_SOCKOPT_NONBLOCKING

   

CAMEL_SOCKOPT_LINGER

   

CAMEL_SOCKOPT_REUSEADDR

   

CAMEL_SOCKOPT_KEEPALIVE

   

CAMEL_SOCKOPT_RECVBUFFERSIZE

   

CAMEL_SOCKOPT_SENDBUFFERSIZE

   

CAMEL_SOCKOPT_IPTIMETOLIVE

   

CAMEL_SOCKOPT_IPTYPEOFSERVICE

   

CAMEL_SOCKOPT_ADDMEMBER

   

CAMEL_SOCKOPT_DROPMEMBER

   

CAMEL_SOCKOPT_MCASTINTERFACE

   

CAMEL_SOCKOPT_MCASTTIMETOLIVE

   

CAMEL_SOCKOPT_MCASTLOOPBACK

   

CAMEL_SOCKOPT_NODELAY

   

CAMEL_SOCKOPT_MAXSEGMENT

   

CAMEL_SOCKOPT_BROADCAST

   

CAMEL_SOCKOPT_LAST

   

CamelLinger

typedef struct linger CamelLinger;

CamelSockOptData

typedef struct {
	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 */
		gsize      max_segment;         /* Maximum segment size */
		gsize      recv_buffer_size;    /* Receive buffer size */
		gsize      send_buffer_size;    /* Send buffer size */
		CamelLinger linger;              /* Time to linger on close if data present */
	} value;
} CamelSockOptData;