The main header file for libafdt. More...
Go to the source code of this file.
Data Structures | |
| struct | afdt_error_t |
| Detailed information about an error. More... | |
Macros | |
| #define | AFDT_FULL_MSGLEN 0x200 |
| Maximum request or response message length, including the header. More... | |
| #define | AFDT_MSGLEN (AFDT_FULL_MSGLEN - sizeof(uint32_t)) |
| Maximum request or response message length, excluding the header. | |
Typedefs | |
| typedef int(* | afdt_request_handler_t )(const uint8_t *request, uint32_t request_length, uint8_t *response, uint32_t *response_length, void *userdata) |
| Callback type for processing an AFDT request. More... | |
| typedef void(* | afdt_response_handler_t )(const uint8_t *response, uint32_t response_length, int received_fd, void *userdata) |
| Callback type for processing an AFDT response. More... | |
| typedef void(* | afdt_post_handler_t )(const uint8_t *request, uint32_t request_length, const uint8_t *response, uint32_t response_length, int sent_fd, void *userdata) |
| Callback type for after a response is sent. More... | |
| typedef void(* | afdt_error_handler_t )(const struct afdt_error_t *err, void *userdata) |
| Callback type for processing errors during AFDT operations. More... | |
Enumerations | |
| enum | afdt_phase { AFDT_NO_PHASE, AFDT_CREATE_SERVER, AFDT_ACCEPT_CLIENT, AFDT_HANDLE_REQUEST, AFDT_CREATE_CLIENT, AFDT_HANDLE_RESPONSE } |
| Phase of the AFDT process during which an error occurred. More... | |
| enum | afdt_operation { AFDT_NO_OPERATION, AFDT_MALLOC, AFDT_SOCKET, AFDT_PATHNAME, AFDT_BIND, AFDT_LISTEN, AFDT_ACCEPT, AFDT_CONNECT, AFDT_FORMAT, AFDT_SENDMSG, AFDT_RECVMSG, AFDT_EVENT_BASE_SET, AFDT_EVENT_ADD, AFDT_POLL, AFDT_TIMEOUT } |
| Operation that resulted in an error. More... | |
Functions | |
| const char * | afdt_phase_str (enum afdt_phase phase) |
Convert afdt_phase into a textual description. | |
| const char * | afdt_operation_str (enum afdt_operation operation) |
Convert afdt_operation into a textual description. | |
| int | afdt_listen (const char *fname, struct afdt_error_t *err) |
| Create a socket that listens for connections. More... | |
| int | afdt_connect (const char *fname, struct afdt_error_t *err) |
| Create a socket and connect to a listening socket. More... | |
| int | afdt_send_fd_msg (int connfd, const uint8_t *content, uint32_t content_len, int fd_to_send, struct afdt_error_t *err) |
| Send a message with an optional file descriptor. More... | |
| int | afdt_send_plain_msg (int connfd, const uint8_t *content, uint32_t content_len, struct afdt_error_t *err) |
| Send a message with no file descriptor. More... | |
| int | afdt_recv_fd_msg (int connfd, uint8_t *content, uint32_t *content_len, int *received_fd, struct afdt_error_t *err) |
| Receive a message with an optional file descriptor. More... | |
| int | afdt_recv_plain_msg (int connfd, uint8_t *content, uint32_t *content_len, struct afdt_error_t *err) |
| Receive a message with no file descriptor. More... | |
| void | afdt_no_post (const uint8_t *request, uint32_t request_length, const uint8_t *response, uint32_t response_length, int sent_fd, void *userdata) |
| No-op function that can be used as a post_handler. | |
| int | afdt_create_server (const char *fname, struct event_base *eb, afdt_request_handler_t request_handler, afdt_post_handler_t post_handler, afdt_error_handler_t error_handler, void **out_close_handle, void *userdata) |
| Create a server to make file descriptors available. More... | |
| int | afdt_close_server (void *close_handle) |
Shut down a server created by afdt_create_server. More... | |
| int | afdt_create_client (const char *fname, struct event_base *eb, const uint8_t *request, uint32_t request_length, afdt_response_handler_t response_handler, afdt_error_handler_t error_handler, const struct timeval *timeout, void *userdata) |
| Request a file descriptor from a server. More... | |
| int | afdt_sync_client (const char *fname, const uint8_t *request, uint32_t request_length, uint8_t *response, uint32_t *response_length, int *received_fd, const struct timeval *timeout, struct afdt_error_t *err) |
| Request a file descriptor from a server. More... | |
Variables | |
| const struct afdt_error_t | AFDT_ERROR_T_INIT |
| Initializer for error information. More... | |
The main header file for libafdt.
This file contains all of the types and functions available in the libafdt API. All other files are for internal use only.
| #define AFDT_FULL_MSGLEN 0x200 |
Maximum request or response message length, including the header.
This is relatively small so that we can consider short reads writes to be exceptional circumstances, rather than business as usual.
1.8.6