axa_client
contains AXA client macros, data type definitions, and function prototypes.
|
void | axa_client_init (axa_client_t *client) |
| (Re-)initialize an AXA client context with default values. More...
|
|
void | axa_client_backoff (axa_client_t *client) |
| Disconnect from the server and increase the delay before trying again. More...
|
|
void | axa_client_backoff_max (axa_client_t *client) |
| Disconnect from the server and increase the delay before trying again to the maximum. More...
|
|
void | axa_client_backoff_reset (axa_client_t *client) |
| Reset the delay before try to connect to zero. More...
|
|
time_t | axa_client_again (axa_client_t *client, struct timeval *now) |
| Get the number of milliseconds before the server connection should be attempted again. More...
|
|
void | axa_client_close (axa_client_t *client) |
| Close the server connection and release buffers. More...
|
|
axa_connect_result_t | axa_client_open (axa_emsg_t *emsg, axa_client_t *client, const char *addr, bool is_rad, bool tun_debug, int bufsize, bool nonblock) |
| Create a new server connection perhaps after closing an existing connection. More...
|
|
axa_connect_result_t | axa_client_connect (axa_emsg_t *emsg, axa_client_t *client) |
| Finish a new connection to an SRA or RAD server. More...
|
|
bool | axa_client_send (axa_emsg_t *emsg, axa_client_t *client, axa_tag_t tag, axa_p_op_t op, axa_p_hdr_t *hdr, const void *body, size_t body_len) |
| Send an AXA message to the server connected through a client context, blocking until finished. More...
|
|
bool | axa_client_hello (axa_emsg_t *emsg, axa_client_t *client, const axa_p_hello_t *hello) |
| Examine HELLO message from server to pick a common protocol version and save session information. More...
|
|
#define AXA_MAX_SRVRLEN (4+64+1025+1) |
maximum length of an AXA server specification such as "unix user@host"
#define AXA_CLIENT_OPENED |
( |
|
client | ) |
AXA_IO_OPENED(&((client)->io)) |
Check than an AXA client context is closed.
- Parameters
-
[in] | client | address of a client context |
Check that an AXA client context is open and connected.
- Parameters
-
[in] | client | address of a client context |
return codes for axa_client_open() and axa_client_connect()
Enumerator |
---|
AXA_CONNECT_ERR |
Permanent failure.
The connection has been closed and axa_client_backoff() called. Check emsg.
|
AXA_CONNECT_TEMP |
Temporary failure.
The connection has been closed and axa_client_backoff() called. Check emsg
|
AXA_CONNECT_DONE |
connection is complete
|
AXA_CONNECT_INCOM |
non-blocking connection waiting for TCP syn-ack or TLS handshake
|
AXA_CONNECT_NOP |
Connection now completed including sending the initial AXA_P_OP_NOP.
emsg contains the result of axa_p_to_str(emsg->c, sizeof(emsg->c), true, ...)
|
AXA_CONNECT_USER |
Connection now completed including sending the initial AXA_P_OP_USER.
An AXA_P_OP_OK or AXA_P_OP_ERROR should be coming. emsg contains the result of axa_p_to_str(emsg->c, sizeof(emsg->c), true, ...)
|
(Re-)initialize an AXA client context with default values.
- Parameters
-
[in] | client | address of a client context |
Disconnect from the server and increase the delay before trying again.
- Parameters
-
[in] | client | address of a client context |
Disconnect from the server and increase the delay before trying again to the maximum.
- Parameters
-
[in] | client | address of a client context |
Reset the delay before try to connect to zero.
- Parameters
-
[in] | client | address of a client context |
time_t axa_client_again |
( |
axa_client_t * |
client, |
|
|
struct timeval * |
now |
|
) |
| |
Get the number of milliseconds before the server connection should be attempted again.
- Parameters
-
[in] | client | address of a client context |
[out] | now | current wall clock time or NULL |
- Returns
- <= 0 if yes
Close the server connection and release buffers.
- Parameters
-
[in] | client | address of a client context |
Create a new server connection perhaps after closing an existing connection.
axa_client_connect() must be called after a result other than AXA_CONNECT_DONE, AXA_CONNECT_NOP, or AXA_CONNECT_USER.
- Parameters
-
[out] | emsg | if something goes wrong, this will contain the reason |
[in] | client | address of a client context |
[in] | is_rad | true if server is radd instead of srad |
[in] | addr | connect to this AXA server specification |
[in] | tun_debug | true to turn on ssh tunnel debugging |
[in] | bufsize | 0 or desired socket buffer sizes |
[in] | nonblock | true to start the connection without blocking and to make the connection non-blocking |
- Return values
-
Finish a new connection to an SRA or RAD server.
The connection must have been previously opened with axa_client_open(), which must have returned AXA_CONNECT_TEMP. axa_client_connect() must be called again when it returns AXA_CONNECT_TEMP.
- Parameters
-
[out] | emsg | if something goes wrong, this will contain the reason |
[in] | client | address of a client context |
- Return values
-
Send an AXA message to the server connected through a client context, blocking until finished.
- Parameters
-
[out] | emsg | if something goes wrong, this will contain the reason |
[in] | client | address of a client context |
[in] | tag | AXA tag |
[in] | op | AXA opcode |
[out] | hdr | AXA protocol header to be built or NULL |
[in] | body | NULL or optional body of the AXA message after the header |
[in] | body_len | length of body |
- Return values
-
Examine HELLO message from server to pick a common protocol version and save session information.
- Parameters
-
[out] | emsg | if something goes wrong, this will contain the reason |
[in] | client | address of the client context default to &client->recv_body->hello if NULL |
[in] | hello | address of the received HELLO message or NULL, which implies client->recv_body->hello |
- Return values
-
true | parameters saved |
false | bad HELLO |