OpenVPN
|
Go to the source code of this file.
Macros | |
#define | RETURN_UPDATE_STATUS(n_sent) |
Functions | |
int | process_incoming_push_update (struct context *c, unsigned int permission_mask, unsigned int *option_types_found, struct buffer *buf, bool msg_sender) |
Handles the receiving of a push-update message and applies updates to the specified options. | |
static int | find_first_comma_of_next_bundle (const char *str, int ix) |
Return index of last , or 0 if it didn't find any. | |
static struct buffer | forge_msg (const char *src, const char *continuation, struct gc_arena *gc) |
static char * | gc_strdup (const char *src, struct gc_arena *gc) |
static bool | message_splitter (const char *s, struct buffer *msgs, struct gc_arena *gc, const int safe_cap) |
static bool | send_single_push_update (struct context *c, struct buffer *msgs, unsigned int *option_types_found) |
int | send_push_update (struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size) |
A function to send a PUSH_UPDATE control message from server to client(s). | |
bool | management_callback_send_push_update_broadcast (void *arg, const char *options) |
bool | management_callback_send_push_update_by_cid (void *arg, unsigned long cid, const char *options) |
#define RETURN_UPDATE_STATUS | ( | n_sent | ) |
Definition at line 277 of file push_util.c.
|
static |
Return index of last ,
or 0
if it didn't find any.
If there is a comma at index 0
it's an error anyway
Definition at line 55 of file push_util.c.
Referenced by message_splitter().
|
static |
Definition at line 70 of file push_util.c.
References alloc_buf_gc(), buf_printf(), gc, buffer::len, and push_update_cmd.
Referenced by message_splitter().
|
static |
Definition at line 82 of file push_util.c.
References gc, gc_malloc(), and buffer::len.
Referenced by message_splitter().
bool management_callback_send_push_update_broadcast | ( | void * | arg, |
const char * | options | ||
) |
Definition at line 294 of file push_util.c.
References PUSH_BUNDLE_SIZE, RETURN_UPDATE_STATUS, send_push_update(), and UPT_BROADCAST.
Referenced by init_management_callback_multi().
bool management_callback_send_push_update_by_cid | ( | void * | arg, |
unsigned long | cid, | ||
const char * | options | ||
) |
Definition at line 302 of file push_util.c.
References PUSH_BUNDLE_SIZE, RETURN_UPDATE_STATUS, send_push_update(), and UPT_BY_CID.
Referenced by init_management_callback_multi().
|
static |
Definition at line 94 of file push_util.c.
References find_first_comma_of_next_bundle(), forge_msg(), gc, gc_strdup(), i, and buffer::len.
Referenced by send_push_update().
int process_incoming_push_update | ( | struct context * | c, |
unsigned int | permission_mask, | ||
unsigned int * | option_types_found, | ||
struct buffer * | buf, | ||
bool | msg_sender | ||
) |
Handles the receiving of a push-update message and applies updates to the specified options.
This function processes a push-update message, validating its content and applying updates to the options specified in the message. It also handles split messages if the complete message has not yet been received.
c | The context for the operation. |
permission_mask | The permission mask specifying which options are allowed to be pulled. |
option_types_found | A pointer to a variable that will be filled with the types of options found in the message. |
buf | A buffer containing the received message. |
msg_sender | A boolean indicating if function is called by the message sender (server). |
PUSH_MSG_UPDATE
: The message was processed successfully, and the updates were applied.PUSH_MSG_CONTINUATION
: The message is a fragment of a larger message, and the program is waiting for the final part.PUSH_MSG_ERROR
: An error occurred during message processing, or the message is invalid. Definition at line 13 of file push_util.c.
References apply_push_options(), buf_read_u8(), context::c2, context_2::es, context::options, options::push_continuation, PUSH_MSG_CONTINUATION, PUSH_MSG_ERROR, PUSH_MSG_UPDATE, and throw_signal_soft().
Referenced by process_incoming_push_msg(), and send_single_push_update().
int send_push_update | ( | struct multi_context * | m, |
const void * | target, | ||
const char * | msg, | ||
const push_update_type | type, | ||
const int | push_bundle_size | ||
) |
A function to send a PUSH_UPDATE control message from server to client(s).
m | the multi_context, contains all the clients connected to this server. |
target | the target to which to send the message. It should be: NULL if type == UPT_BROADCAST , a mroute_addr * if type == UPT_BY_ADDR , a char * if type == UPT_BY_CN , an unsigned long * if type == UPT_BY_CID . |
msg | a string containing the options to send. |
type | the way to address the message (broadcast, by cid, by cn, by address). |
push_bundle_size | the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. |
Definition at line 187 of file push_util.c.
References context::c2, multi_instance::context, gc, gc_free(), gc_malloc(), gc_new(), multi_instance::halt, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), options::ifconfig_ipv6_local, options::ifconfig_local, multi_context::iter, buffer::len, lookup_by_cid(), M_CLIENT, message_splitter(), msg, OPT_P_UP, context::options, tls_multi::peer_id, push_update_cmd, send_single_push_update(), context_2::tls_multi, update_vhash(), UPT_BROADCAST, UPT_BY_CID, and hash_element::value.
Referenced by management_callback_send_push_update_broadcast(), management_callback_send_push_update_by_cid(), test_send_push_msg0(), test_send_push_msg1(), test_send_push_msg10(), test_send_push_msg2(), test_send_push_msg3(), test_send_push_msg4(), test_send_push_msg5(), test_send_push_msg6(), test_send_push_msg7(), test_send_push_msg8(), and test_send_push_msg9().
|
static |
Definition at line 141 of file push_util.c.
References BSTR, buf_string_compare_advance(), D_PUSH, buffer::data, i, buffer::len, M_WARN, msg, options_postprocess_pull(), process_incoming_push_update(), pull_permission_mask(), PUSH_MSG_ERROR, push_update_cmd, and send_control_channel_string().
Referenced by send_push_update().