<refentry id="camel-CamelTcpStream">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelTcpStream.top_of_page">CamelTcpStream</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelTcpStream</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="camel-CamelTcpStream.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
struct              <link linkend="CamelTcpStream">CamelTcpStream</link>;
enum                <link linkend="CamelSockOpt">CamelSockOpt</link>;
typedef             <link linkend="CamelLinger">CamelLinger</link>;
                    <link linkend="CamelSockOptData">CamelSockOptData</link>;
<link linkend="int">int</link>                 <link linkend="camel-tcp-stream-connect">camel_tcp_stream_connect</link>            (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="struct-addrinfo">struct addrinfo</link> *host);
<link linkend="int">int</link>                 <link linkend="camel-tcp-stream-getsockopt">camel_tcp_stream_getsockopt</link>         (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="CamelSockOptData">CamelSockOptData</link> *data);
<link linkend="int">int</link>                 <link linkend="camel-tcp-stream-setsockopt">camel_tcp_stream_setsockopt</link>         (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         const <link linkend="CamelSockOptData">CamelSockOptData</link> *data);
struct <link linkend="sockaddr">sockaddr</link> *   <link linkend="camel-tcp-stream-get-local-address">camel_tcp_stream_get_local_address</link>  (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="socklen-t">socklen_t</link> *len);
struct <link linkend="sockaddr">sockaddr</link> *   <link linkend="camel-tcp-stream-get-remote-address">camel_tcp_stream_get_remote_address</link> (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="socklen-t">socklen_t</link> *len);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelTcpStream.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="camel-CamelTcpStream.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelTcpStream" role="struct">
<title>struct CamelTcpStream</title>
<indexterm zone="CamelTcpStream"><primary sortas="CamelTcpStream">CamelTcpStream</primary></indexterm><programlisting>struct CamelTcpStream {
	CamelStream parent_object;
};
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelSockOpt" role="enum">
<title>enum CamelSockOpt</title>
<indexterm zone="CamelSockOpt"><primary sortas="CamelSockOpt">CamelSockOpt</primary></indexterm><programlisting>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;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelLinger" role="typedef">
<title>CamelLinger</title>
<indexterm zone="CamelLinger"><primary sortas="CamelLinger">CamelLinger</primary></indexterm><programlisting>typedef struct linger CamelLinger;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelSockOptData" role="struct">
<title>CamelSockOptData</title>
<indexterm zone="CamelSockOptData"><primary sortas="CamelSockOptData">CamelSockOptData</primary></indexterm><programlisting>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 */
		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;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-tcp-stream-connect" role="function">
<title>camel_tcp_stream_connect ()</title>
<indexterm zone="camel-tcp-stream-connect"><primary sortas="camel_tcp_stream_connect">camel_tcp_stream_connect</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_tcp_stream_connect            (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="struct-addrinfo">struct addrinfo</link> *host);</programlisting>
<para>
Create a socket and connect based upon the data provided.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelTcpStream"><type>CamelTcpStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>host</parameter>&#160;:</term>
<listitem><simpara> a linked list of addrinfo structures to try to connect, in
the order of most likely to least likely to work.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-tcp-stream-getsockopt" role="function">
<title>camel_tcp_stream_getsockopt ()</title>
<indexterm zone="camel-tcp-stream-getsockopt"><primary sortas="camel_tcp_stream_getsockopt">camel_tcp_stream_getsockopt</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_tcp_stream_getsockopt         (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="CamelSockOptData">CamelSockOptData</link> *data);</programlisting>
<para>
Get the socket options set on the stream and populate <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelTcpStream"><type>CamelTcpStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> socket option data
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-tcp-stream-setsockopt" role="function">
<title>camel_tcp_stream_setsockopt ()</title>
<indexterm zone="camel-tcp-stream-setsockopt"><primary sortas="camel_tcp_stream_setsockopt">camel_tcp_stream_setsockopt</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_tcp_stream_setsockopt         (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         const <link linkend="CamelSockOptData">CamelSockOptData</link> *data);</programlisting>
<para>
Set the socket options contained in <parameter>data</parameter> on the stream.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelTcpStream"><type>CamelTcpStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> socket option data
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="0--CAPS"><literal>0</literal></link> on success or <link linkend="1--CAPS"><literal>-1</literal></link> on fail
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-tcp-stream-get-local-address" role="function">
<title>camel_tcp_stream_get_local_address ()</title>
<indexterm zone="camel-tcp-stream-get-local-address"><primary sortas="camel_tcp_stream_get_local_address">camel_tcp_stream_get_local_address</primary></indexterm><programlisting>struct <link linkend="sockaddr">sockaddr</link> *   camel_tcp_stream_get_local_address  (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="socklen-t">socklen_t</link> *len);</programlisting>
<para>
Get the local address of <parameter>stream</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelTcpStream"><type>CamelTcpStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> pointer to address length which must be supplied
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the stream's local address (which must be freed with
<link linkend="g-free"><type>g_free</type></link>) if the stream is connected, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if not
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-tcp-stream-get-remote-address" role="function">
<title>camel_tcp_stream_get_remote_address ()</title>
<indexterm zone="camel-tcp-stream-get-remote-address"><primary sortas="camel_tcp_stream_get_remote_address">camel_tcp_stream_get_remote_address</primary></indexterm><programlisting>struct <link linkend="sockaddr">sockaddr</link> *   camel_tcp_stream_get_remote_address (<link linkend="CamelTcpStream">CamelTcpStream</link> *stream,
                                                         <link linkend="socklen-t">socklen_t</link> *len);</programlisting>
<para>
Get the remote address of <parameter>stream</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>stream</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="CamelTcpStream"><type>CamelTcpStream</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> pointer to address length, which must be supplied
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the stream's remote address (which must be freed with
<link linkend="g-free"><type>g_free</type></link>) if the stream is connected, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if not.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
