|
Udipe 1.0
Solving the riddle of high-throughput UDP
|
Core libudipe context.
More...
#include "buffer.h"#include "log.h"#include "nodiscard.h"#include "pointer.h"#include "visibility.h"Go to the source code of this file.
Data Structures | |
| struct | udipe_config_s |
Typedefs | |
| typedef struct udipe_config_s | udipe_config_t |
| typedef struct udipe_context_s | udipe_context_t |
Functions | |
| UDIPE_NODISCARD UDIPE_NON_NULL_RESULT UDIPE_PUBLIC udipe_context_t * | udipe_initialize (udipe_config_t config) |
| UDIPE_PUBLIC UDIPE_NON_NULL_ARGS void | udipe_finalize (udipe_context_t *context) |
This header is the home of udipe_context_t, the core context object that you will need for any nontrivial interaction with the libudipe API.
It also provides the following related tools:
| typedef struct udipe_config_s udipe_config_t |
Core libudipe configuration
This data structure is used to configure the behavior of udipe_initialize(). It is designed such that zero-initializing it should result in sane defaults for many applications.
| typedef struct udipe_context_s udipe_context_t |
Core libudipe context
A pointer to this opaque data structure is built by udipe_initialize() and can subsequently be passed to most libudipe API entry points for the purpose of performing UDP network operations.
Its content is an opaque implementation detail of libudipe that you should not attempt to read or modify.
Once you are done with libudipe, you can pass this object back to udipe_finalize() to destroy it.
| UDIPE_PUBLIC UDIPE_NON_NULL_ARGS void udipe_finalize | ( | udipe_context_t * | context | ) |
Finalize a libudipe context
This function cancels all unfinished libudipe transactions, waits for uninterruptible asynchronous work to complete, and liberates the resources formerly allocated by udipe_initialize().
Although udipe_finalize() may take a short amount of time to complete, its pointer invalidation effect should be considered instantaneous: starting from the moment where you start calling this function, you must not call any libudipe function with this udipe_context_t* parameter from any of your application threads.
| UDIPE_NODISCARD UDIPE_NON_NULL_RESULT UDIPE_PUBLIC udipe_context_t * udipe_initialize | ( | udipe_config_t | config | ) |
Initialize a libudipe context
You should normally only need to call this function once at the start of your application. It is configured using a udipe_config_t data structure, which is designed to be zero-initialization safe, and it produces the opaque udipe_context_t* pointer that you will need to use most other functions from libudipe
You must not attempt to read or modify the resulting udipe_context_t object in any way until you are done with libudipe, at which point you must pass it to udipe_finalize() to safely destroy it before the application terminates.
This function currently only has fatal error cases, which it handles using exit(EXIT_FAILURE). It is therefore guaranteed to return a non-null pointer if it returns at all.