OpenVPN
push.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef PUSH_H
24#define PUSH_H
25
26#include "forward.h"
27
28#define PUSH_MSG_ERROR 0
29#define PUSH_MSG_REQUEST 1
30#define PUSH_MSG_REPLY 2
31#define PUSH_MSG_REQUEST_DEFERRED 3
32#define PUSH_MSG_AUTH_FAILURE 4
33#define PUSH_MSG_CONTINUATION 5
34#define PUSH_MSG_ALREADY_REPLIED 6
35#define PUSH_MSG_UPDATE 7
36
37#define push_reply_cmd "PUSH_REPLY"
38#define push_update_cmd "PUSH_UPDATE"
39
40/* Push-update options flags */
41#define PUSH_OPT_TO_REMOVE (1 << 0)
42#define PUSH_OPT_OPTIONAL (1 << 1)
43
44#ifdef ENABLE_MANAGEMENT
45/* Push-update message sender modes */
46typedef enum
47{
49 UPT_BY_CID = 1
51#endif
52
54
77int process_incoming_push_update(struct context *c, unsigned int permission_mask,
78 unsigned int *option_types_found, struct buffer *buf,
79 bool msg_sender);
80
81int process_incoming_push_msg(struct context *c, const struct buffer *buffer,
82 bool honor_received_options, unsigned int permission_mask,
83 unsigned int *option_types_found);
84
85bool send_push_request(struct context *c);
86
87void receive_auth_failed(struct context *c, const struct buffer *buffer);
88
89void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart,
90 const int adv);
91
92void receive_exit_message(struct context *c);
93
94void server_pushed_info(const struct buffer *buffer, const int adv);
95
96void receive_cr_response(struct context *c, const struct buffer *buffer);
97
98void incoming_push_message(struct context *c, const struct buffer *buffer);
99
100void clone_push_list(struct options *o);
101
102void push_option(struct options *o, const char *opt, int msglevel);
103
104void push_options(struct options *o, char **p, int msglevel, struct gc_arena *gc);
105
106void push_reset(struct options *o);
107
108void push_remove_option(struct options *o, const char *p);
109
111
112void send_auth_failed(struct context *c, const char *client_reason);
113
120 const char *extra, unsigned int timeout);
121
122void send_restart(struct context *c, const char *kill_msg);
123
131void send_push_reply_auth_token(struct tls_multi *multi);
132
139void receive_auth_pending(struct context *c, const struct buffer *buffer);
140
141#ifdef ENABLE_MANAGEMENT
156int
157send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size);
158
160
161bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options);
162
163#endif /* ifdef ENABLE_MANAGEMENT*/
164
165#endif /* ifndef PUSH_H */
Interface functions to the internal and external multiplexers.
#define msg(flags,...)
Definition error.h:150
int process_incoming_push_request(struct context *c)
Definition push.c:974
void receive_auth_pending(struct context *c, const struct buffer *buffer)
Parses an AUTH_PENDING message and if in pull mode extends the timeout.
Definition push.c:336
void receive_auth_failed(struct context *c, const struct buffer *buffer)
Definition push.c:48
void send_restart(struct context *c, const char *kill_msg)
Definition push.c:490
void push_option(struct options *o, const char *opt, int msglevel)
Definition push.c:884
push_update_type
Definition push.h:47
@ UPT_BY_CID
Definition push.h:49
@ UPT_BROADCAST
Definition push.h:48
void server_pushed_signal(struct context *c, const struct buffer *buffer, const bool restart, const int adv)
Definition push.c:128
void push_reset(struct options *o)
Definition push.c:931
void receive_cr_response(struct context *c, const struct buffer *buffer)
Definition push.c:263
void send_auth_failed(struct context *c, const char *client_reason)
Definition push.c:393
void clone_push_list(struct options *o)
Definition push.c:890
void receive_exit_message(struct context *c)
Definition push.c:189
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).
Definition push_util.c:187
bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options)
Definition push_util.c:302
bool send_push_request(struct context *c)
Definition push.c:563
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.
Definition push.c:434
void push_remove_option(struct options *o, const char *p)
Definition push.c:937
bool management_callback_send_push_update_broadcast(void *arg, const char *options)
Definition push_util.c:294
void incoming_push_message(struct context *c, const struct buffer *buffer)
Definition push.c:501
void push_options(struct options *o, char **p, int msglevel, struct gc_arena *gc)
Definition push.c:905
void remove_iroutes_from_push_route_list(struct options *o)
Definition push.c:1120
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)
Definition push.c:1090
void server_pushed_info(const struct buffer *buffer, const int adv)
Definition push.c:225
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.
Definition push_util.c:13
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.
Definition push.c:772
Wrapper structure for dynamically allocated memory.
Definition buffer.h:60
Contains all state information for one tunnel.
Definition openvpn.h:474
Garbage collection arena used to keep track of dynamically allocated memory.
Definition buffer.h:116
Main OpenVPN server state structure.
Definition multi.h:164
Security parameter state for a single VPN tunnel.
Definition ssl_common.h:612
Security parameter state of a single session within a VPN tunnel.
Definition ssl_common.h:490
struct gc_arena gc
Definition test_ssl.c:154