Core library operations

Core library operations — Methods and types to initialize and teardown the library.

Functions

const char * ratp_status_str ()
ratp_status_t ratp_init ()

Types and Values

Description

This section defines the core types and methods exposed by the RATP library.

Example 1. Initializing and tearing down the library

1
2
3
4
5
6
7
8
ratp_status_t  st;

if ((st = ratp_init ()) != RATP_STATUS_OK) {
  fprintf (stderr, "error: couldn't initialize RATP library: %s\n", ratp_status_str (st));
  return EXIT_FAILURE;
}

// Use the library here

Functions

ratp_status_str ()

const char *
ratp_status_str (ratp_status_t st);

Gets a description for the given ratp_status_t.

Parameters

st

a ratp_status_t.

[in]

Returns

a constant string.


ratp_init ()

ratp_status_t
ratp_init (void);

Initialize the library.

If ratp_init() fails, no further library operations may be executed, it is a fatal error.

Returns

a ratp_status_t.

Types and Values

enum ratp_status_t

Status of an operation performed with the RATP library.

Members

RATP_STATUS_OK

Operation successful.

 

RATP_STATUS_ERROR

Operation failed.

 

RATP_STATUS_ERROR_NO_MEMORY

Not enough memory.

 

RATP_STATUS_INVALID_TRANSITION

Invalid state transition.

 

RATP_STATUS_WRITE_ERROR

Writing to the link failed.

 

RATP_STATUS_READ_ERROR

Reading from the link failed.

 

RATP_STATUS_TIMEOUT

Operation timed out.

 

RATP_STATUS_INVALID_DATA

Invalid data.

 

RATP_STATUS_DATA_REFUSED

Data refused by peer.

 

RATP_STATUS_DATA_LEFT_UNSENT

Data left unsent.

 

RATP_STATUS_CONNECTION_REFUSED

Connection refused by peer.

 

RATP_STATUS_CONNECTION_RESET

Connection reset by peer.

 

RATP_STATUS_CONNECTION_CLOSING

Connection closing.

 

RATP_STATUS_CONNECTION_ABORTED_USER_TIMEOUT

Connection aborted due to user timeout.

 

RATP_STATUS_CONNECTION_ABORTED_RETRANSMISSION_FAILURE

Connection aborted due to retransmission failures.