of the message's sequence number. Due to the unreliable nature of the protocol, this field allows distinguishing out-of-order messages. -- Function: ssize_t gnutls_record_recv_seq (gnutls_session_t SESSION, void * DATA, size_t DATA_SIZE, unsigned char * SEQ) SESSION: is a ‘gnutls_session_t’ type. DATA: the buffer that the data will be read into DATA_SIZE: the number of requested bytes SEQ: is the packet's 64-bit sequence number. Should have space for 8 bytes. This function is the same as ‘gnutls_record_recv()’ , except that it returns in addition to data, the sequence number of the data. This is useful in DTLS where record packets might be received out-of-order. The returned 8-byte sequence number is an integer in big-endian format and should be treated as a unique message identification. *Returns:* The number of bytes received and zero on EOF. A negative error code is returned in case of an error. The number of bytes received might be less than ‘data_size’ . *Since:* 3.0 The *note gnutls_record_check_pending:: helper function is available to allow checking whether data are available to be read in a GnuTLS session buffers. Note that this function complements but does not replace ‘poll’, i.e., *note gnutls_record_check_pending:: reports no data to be read, ‘poll’ should be called to check for data in the network buffers. -- Function: size_t gnutls_record_check_pending (gnutls_session_t SESSION) SESSION: is a ‘gnutls_session_t’ type. This function checks if there are unread data in the gnutls buffers. If the return value is non-zero the next call to ‘gnutls_record_recv()’ is guaranteed not to block. *Returns:* Returns the size of the data or zero. ‘INT *note gnutls_record_get_direction:: (gnutls_session_t SESSION)’ Once a TLS or DTLS session is no longer needed, it is recommended to use *note gnutls_bye:: to terminate the session. That way the peer is notified securely about the intention of termination, which allows distinguishing it from a malicious connection termination. A session can be deinitialized with the *note gnutls_deinit:: function. -- Function: int gnutls_bye (gnutls_session_t SESSION, gnutls_close_request_t HOW) SESSION: is a ‘gnutls_session_t’ type. HOW: is an integer Terminates the current TLS/SSL connection. The connection should have been initiated using ‘gnutls_handshake()’ . ‘how’ should be one of ‘GNUTLS_SHUT_RDWR’ , ‘GNUTLS_SHUT_WR’ . In case of ‘GNUTLS_SHUT_RDWR’ the TLS session gets terminated and further receives and sends will be disallowed. If the return value is zero you may continue using the underlying transport layer. ‘GNUTLS_SHUT_RDWR’ sends an alert containing a close request and waits for the peer to reply with the same message. In case of ‘GNUTLS_SHUT_WR’ the TLS session gets terminated and further sends will be disallowed. In order to reuse the connection you should wait for an EOF from the peer. ‘GNUTLS_SHUT_WR’ sends an alert containing a close request. Note that not all implementations will properly terminate a TLS connection. Some of them, usually for performance reasons, will terminate only the underlying transport layer, and thus not distinguishing between a malicious party prematurely terminating the connection and normal termination. This function may also return ‘GNUTLS_E_AGAIN’ or ‘GNUTLS_E_INTERRUPTED’ ; cf. ‘gnutls_record_get_direction()’ . *Returns:* ‘GNUTLS_E_SUCCESS’ on success, or an error code, see function documentation for entire semantics. -- Function: void gnutls_deinit (gnutls_session_t SESSION) SESSION: is a ‘gnutls_session_t’ type. This function clears all buffers associated with the ‘session’ . This function will also remove session data from the session database if the session was terminated abnormally.