OpenVPN
Macros | Enumerations | Functions
push.h File Reference
#include "forward.h"
Include dependency graph for push.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PUSH_MSG_ERROR   0
 
#define PUSH_MSG_REQUEST   1
 
#define PUSH_MSG_REPLY   2
 
#define PUSH_MSG_REQUEST_DEFERRED   3
 
#define PUSH_MSG_AUTH_FAILURE   4
 
#define PUSH_MSG_CONTINUATION   5
 
#define PUSH_MSG_ALREADY_REPLIED   6
 
#define PUSH_MSG_UPDATE   7
 
#define push_reply_cmd   "PUSH_REPLY"
 
#define push_update_cmd   "PUSH_UPDATE"
 
#define PUSH_OPT_TO_REMOVE   (1 << 0)
 
#define PUSH_OPT_OPTIONAL   (1 << 1)
 

Enumerations

enum  push_update_type { UPT_BROADCAST = 0 , UPT_BY_CID = 1 }
 

Functions

int process_incoming_push_request (struct context *c)
 
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.
 
int process_incoming_push_msg (struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask, unsigned int *option_types_found)
 
bool send_push_request (struct context *c)
 
void receive_auth_failed (struct context *c, const struct buffer *buffer)
 
void server_pushed_signal (struct context *c, const struct buffer *buffer, const bool restart, const int adv)
 
void receive_exit_message (struct context *c)
 
void server_pushed_info (const struct buffer *buffer, const int adv)
 
void receive_cr_response (struct context *c, const struct buffer *buffer)
 
void incoming_push_message (struct context *c, const struct buffer *buffer)
 
void clone_push_list (struct options *o)
 
void push_option (struct options *o, const char *opt, int msglevel)
 
void push_options (struct options *o, char **p, int msglevel, struct gc_arena *gc)
 
void push_reset (struct options *o)
 
void push_remove_option (struct options *o, const char *p)
 
void remove_iroutes_from_push_route_list (struct options *o)
 
void send_auth_failed (struct context *c, const char *client_reason)
 
bool send_auth_pending_messages (struct tls_multi *tls_multi, struct tls_session *session, const char *extra, unsigned int timeout)
 Sends the auth pending control messages to a client.
 
void send_restart (struct context *c, const char *kill_msg)
 
void send_push_reply_auth_token (struct tls_multi *multi)
 Sends a push reply message only containin the auth-token to update the auth-token on the client.
 
void receive_auth_pending (struct context *c, const struct buffer *buffer)
 Parses an AUTH_PENDING message and if in pull mode extends the timeout.
 
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)
 

Macro Definition Documentation

◆ PUSH_MSG_ALREADY_REPLIED

#define PUSH_MSG_ALREADY_REPLIED   6

Definition at line 34 of file push.h.

◆ PUSH_MSG_AUTH_FAILURE

#define PUSH_MSG_AUTH_FAILURE   4

Definition at line 32 of file push.h.

◆ PUSH_MSG_CONTINUATION

#define PUSH_MSG_CONTINUATION   5

Definition at line 33 of file push.h.

◆ PUSH_MSG_ERROR

#define PUSH_MSG_ERROR   0

Definition at line 28 of file push.h.

◆ PUSH_MSG_REPLY

#define PUSH_MSG_REPLY   2

Definition at line 30 of file push.h.

◆ PUSH_MSG_REQUEST

#define PUSH_MSG_REQUEST   1

Definition at line 29 of file push.h.

◆ PUSH_MSG_REQUEST_DEFERRED

#define PUSH_MSG_REQUEST_DEFERRED   3

Definition at line 31 of file push.h.

◆ PUSH_MSG_UPDATE

#define PUSH_MSG_UPDATE   7

Definition at line 35 of file push.h.

◆ PUSH_OPT_OPTIONAL

#define PUSH_OPT_OPTIONAL   (1 << 1)

Definition at line 42 of file push.h.

◆ PUSH_OPT_TO_REMOVE

#define PUSH_OPT_TO_REMOVE   (1 << 0)

Definition at line 41 of file push.h.

◆ push_reply_cmd

#define push_reply_cmd   "PUSH_REPLY"

Definition at line 37 of file push.h.

◆ push_update_cmd

#define push_update_cmd   "PUSH_UPDATE"

Definition at line 38 of file push.h.

Enumeration Type Documentation

◆ push_update_type

Enumerator
UPT_BROADCAST 
UPT_BY_CID 

Definition at line 46 of file push.h.

Function Documentation

◆ clone_push_list()

void clone_push_list ( struct options o)

◆ incoming_push_message()

void incoming_push_message ( struct context c,
const struct buffer buffer 
)

◆ management_callback_send_push_update_broadcast()

bool management_callback_send_push_update_broadcast ( void *  arg,
const char *  options 
)

◆ management_callback_send_push_update_by_cid()

bool management_callback_send_push_update_by_cid ( void *  arg,
unsigned long  cid,
const char *  options 
)

◆ process_incoming_push_msg()

int process_incoming_push_msg ( struct context c,
const struct buffer buffer,
bool  honor_received_options,
unsigned int  permission_mask,
unsigned int *  option_types_found 
)

◆ process_incoming_push_request()

int process_incoming_push_request ( struct context c)

◆ process_incoming_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.

Parameters
cThe context for the operation.
permission_maskThe permission mask specifying which options are allowed to be pulled.
option_types_foundA pointer to a variable that will be filled with the types of options found in the message.
bufA buffer containing the received message.
msg_senderA boolean indicating if function is called by the message sender (server).
Returns
  • 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().

◆ push_option()

void push_option ( struct options o,
const char *  opt,
int  msglevel 
)

◆ push_options()

void push_options ( struct options o,
char **  p,
int  msglevel,
struct gc_arena gc 
)

Definition at line 905 of file push.c.

References gc, make_extended_arg_array(), print_argv(), and push_option().

Referenced by add_option().

◆ push_remove_option()

void push_remove_option ( struct options o,
const char *  p 
)

◆ push_reset()

void push_reset ( struct options o)

Definition at line 931 of file push.c.

References CLEAR, and options::push_list.

Referenced by add_option(), and clone_push_list().

◆ receive_auth_failed()

void receive_auth_failed ( struct context c,
const struct buffer buffer 
)

◆ receive_auth_pending()

void receive_auth_pending ( struct context c,
const struct buffer buffer 
)

Parses an AUTH_PENDING message and if in pull mode extends the timeout.

Parameters
cThe context struct
bufferBuffer containing the control message with AUTH_PENDING

Definition at line 336 of file push.c.

References context::c2, D_PUSH, key_state::established, get_primary_key(), buffer::len, max_uint(), min_uint(), msg, parse_auth_pending_keywords(), context_2::push_request_timeout, and context_2::tls_multi.

Referenced by parse_incoming_control_channel_command().

◆ receive_cr_response()

void receive_cr_response ( struct context c,
const struct buffer buffer 
)

◆ receive_exit_message()

void receive_exit_message ( struct context c)

◆ remove_iroutes_from_push_route_list()

void remove_iroutes_from_push_route_list ( struct options o)

◆ send_auth_failed()

void send_auth_failed ( struct context c,
const char *  client_reason 
)

◆ send_auth_pending_messages()

bool send_auth_pending_messages ( struct tls_multi tls_multi,
struct tls_session session,
const char *  extra,
unsigned int  timeout 
)

◆ send_push_reply_auth_token()

void send_push_reply_auth_token ( struct tls_multi multi)

Sends a push reply message only containin the auth-token to update the auth-token on the client.

Always pushes to the active session

Parameters
multi- The tls_multi structure belonging to the instance to push to

Definition at line 772 of file push.c.

References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), D_PUSH, push_entry::enable, gc, gc_free(), gc_new(), push_list::head, buffer::len, prepare_auth_token_push_reply(), PUSH_BUNDLE_SIZE, push_reply_cmd, send_control_channel_string_dowork(), tls_multi::session, and TM_ACTIVE.

Referenced by resend_auth_token_renegotiation().

◆ send_push_request()

bool send_push_request ( struct context c)

◆ send_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).

Parameters
mthe multi_context, contains all the clients connected to this server.
targetthe 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.
msga string containing the options to send.
typethe way to address the message (broadcast, by cid, by cn, by address).
push_bundle_sizethe maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
Returns
the number of clients to which the message was sent.

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().

◆ send_restart()

void send_restart ( struct context c,
const char *  kill_msg 
)

Definition at line 490 of file push.c.

References D_PUSH, buffer::len, schedule_exit(), and send_control_channel_string().

Referenced by management_kill_by_cid().

◆ server_pushed_info()

void server_pushed_info ( const struct buffer buffer,
const int  adv 
)

◆ server_pushed_signal()

void server_pushed_signal ( struct context c,
const struct buffer buffer,
const bool  restart,
const int  adv 
)