@showfuncdesc{gnutls_transport_set_errno}
-@acronym{GnuTLS} currently only interprets the EINTR and EAGAIN errno
+@acronym{GnuTLS} currently only interprets the EINTR, EAGAIN and EMSGSIZE errno
values and returns the corresponding @acronym{GnuTLS} error codes:
@itemize
@item @code{GNUTLS_E_INTERRUPTED}
@item @code{GNUTLS_E_AGAIN}
+@item @code{GNUTLS_E_LARGE_PACKET}
@end itemize
The EINTR and EAGAIN values are returned by interrupted system calls,
or when non blocking IO is used. All @acronym{GnuTLS} functions can be
-resumed (called again), if any of the above error codes is returned.
+resumed (called again), if any of the above error codes is returned. The
+EMSGSIZE value is returned when attempting to send a large datagram.
In the case of DTLS it is also desirable to override the generic
transport functions with functions that emulate the operation
_gnutls_read_log ("READ: %d returned from %p, errno=%d gerrno=%d\n",
(int) i, fd, errno, session->internals.errnum);
- if (err == EAGAIN)
- {
- ret = GNUTLS_E_AGAIN;
- goto cleanup;
- }
- else if (err == EINTR)
+ switch(err)
{
- ret = GNUTLS_E_INTERRUPTED;
- goto cleanup;
- }
- else
- {
- gnutls_assert ();
- ret = GNUTLS_E_PULL_ERROR;
- goto cleanup;
+ case EAGAIN:
+ ret = GNUTLS_E_AGAIN;
+ goto cleanup;
+ case EINTR:
+ ret = GNUTLS_E_INTERRUPTED;
+ goto cleanup;
+ case EMSGSIZE:
+ ret = GNUTLS_E_LARGE_PACKET;
+ default:
+ gnutls_assert ();
+ ret = GNUTLS_E_PULL_ERROR;
}
+ goto cleanup;
}
else
{
ERROR_ENTRY (N_("An algorithm that is not enabled was negotiated."),
GNUTLS_E_UNWANTED_ALGORITHM, 1),
- ERROR_ENTRY (N_("A large TLS record packet was received."),
- GNUTLS_E_LARGE_PACKET, 1),
ERROR_ENTRY (N_("A record packet with illegal version was received."),
GNUTLS_E_UNSUPPORTED_VERSION_PACKET, 1),
ERROR_ENTRY (N_
GNUTLS_E_KEY_USAGE_VIOLATION, 1),
ERROR_ENTRY (N_("Resource temporarily unavailable, try again."),
GNUTLS_E_AGAIN, 0),
+ ERROR_ENTRY (N_("The transmitted packet is too large (EMSGSIZE)."),
+ GNUTLS_E_LARGE_PACKET, 0),
ERROR_ENTRY (N_("Function was interrupted."), GNUTLS_E_INTERRUPTED, 0),
ERROR_ENTRY (N_("Rehandshake was requested by the peer."),
GNUTLS_E_REHANDSHAKE, 0),
* %GNUTLS_E_INTERRUPTED or %GNUTLS_E_AGAIN is returned, you must
* call this function again, with the same parameters; alternatively
* you could provide a %NULL pointer for data, and 0 for
- * size. cf. gnutls_record_get_direction().
+ * size. cf. gnutls_record_get_direction(). The errno value EMSGSIZE
+ * maps to %GNUTLS_E_LARGE_PACKET.
*
* Returns: The number of bytes sent, or a negative error code. The
* number of bytes sent might be less than @data_size. The maximum
case WSAEINTR:
ret = EINTR;
break;
+ case WSAEMSGSIZE:
+ ret = EMSGSIZE;
+ break;
default:
ret = EIO;
break;