manpagez: man pages & more
info gnutls
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5 Setting up the transport layer

The next step is to setup the underlying transport layer details. The Berkeley sockets are implicitly used by GnuTLS, thus a call to gnutls_transport_set_ptr2 would be sufficient to specify the socket descriptor.

If however another transport layer than TCP is selected, then the following functions have to be specified.

The functions above accept a callback function which should return the number of bytes written, or -1 on error and should set errno appropriately. In some environments, setting errno is unreliable. For example Windows have several errno variables in different CRTs, or in other systems it may be a non thread-local variable. If this is a concern to you, call gnutls_transport_set_errno with the intended errno value instead of setting errno directly.

GnuTLS currently only interprets the EINTR and EAGAIN errno values and returns the corresponding GnuTLS error codes:

The EINTR and EAGAIN values are returned by interrupted system calls, or when non blocking IO is used. All GnuTLS functions can be resumed (called again), if any of the above error codes is returned.

In the case of DTLS it is also desirable to override the generic transport functions with functions that emulate the operation of recvfrom and sendto. In addition DTLS requires timers during the receive of a handshake message. This requires the gnutls_transport_set_pull_timeout_function function to be used.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 21, 2012 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.