|
OpenVPN
|
#include "openvpn.h"

Go to the source code of this file.
Macros | |
| #define | ACC_MIN_MSG_LEN 64 |
| #define | ACC_MAX_MSG_LEN 1280 |
Enumerations | |
| enum | acc_message_flag { ACC_MESSAGE_FLAGS_ASCII = 1 , ACC_MESSAGE_FLAGS_BASE64 = 2 , ACC_MESSAGE_FLAGS_FRAGMENT = 4 } |
| Flags returned by the parse_acc_message_flags method. More... | |
Functions | |
| void | receive_acc_message (struct context *c, const struct buffer *buffer) |
| This method parses an app custom control message and delivers it to the management interface. | |
| bool | send_acc_message (struct context *c, struct tls_multi *tls_multi, struct tls_session *session, const char *protocol, bool fragment, const char *msg, bool base64) |
| char * | parse_acc_parameters (const char *capabilities, const char *delim, int *max_acc_len, bool server, struct gc_arena *gc) |
| Parses an info message from the server that contains app custom control info information prior to the PUSH_REPLY to be able to use app custom control protocols before sending. | |
| void | determine_common_acc_protocols (struct tls_multi *multi, struct tls_session *session) |
| Parses the IV_ACC of the peer and sets multi.acc_negotiated_protocols to the common protocols of server and client and multi.acc_max_message_length to the maximum length of the ACC message support by both server and client. | |
| int | parse_acc_message_flags (const char *flags, const char **err_reason, struct gc_arena *gc) |
| Parses the flags field of an app control message If there is an error parsing the flags field the method returns -1 and puts the error reason in err_reason. | |
| struct buffer | get_list_intersection (struct gc_arena *gc, const char *list1, const char *list2) |
| Calculates the intersection of two list that are both separated by : Items in the result will have the same ordering as in the list1 parameters. | |
| void | notify_client_acc_protocols (struct tls_multi *multi) |
| Notifies a client via management interface of the negotiated app custom protocols. | |
| #define ACC_MAX_MSG_LEN 1280 |
Definition at line 32 of file acc.h.
Referenced by add_option(), parse_acc_parameters(), push_peer_info(), and test_acc_common_protocols().
| #define ACC_MIN_MSG_LEN 64 |
Definition at line 31 of file acc.h.
Referenced by add_option(), and parse_acc_parameters().
| enum acc_message_flag |
| void determine_common_acc_protocols | ( | struct tls_multi * | multi, |
| struct tls_session * | session ) |
Parses the IV_ACC of the peer and sets multi.acc_negotiated_protocols to the common protocols of server and client and multi.acc_max_message_length to the maximum length of the ACC message support by both server and client.
If there is no common protocol or the client does not support any app custom protocol multi.acc_negotiated_protocols will be set to NULL.
| multi | the multi instance to use the set the app custom protocols. |
| session | the session to read the client env from |
Definition at line 382 of file acc.c.
References tls_multi::acc_max_message_length, tls_multi::acc_negotiated_protocols, tls_options::acc_protocols, buf_len(), buf_str(), D_PUSH_DEBUG, D_PUSH_ERRORS, extract_var_peer_info(), gc, gc_free(), gc_new(), get_list_intersection(), msg, tls_multi::opt, parse_acc_parameters(), tls_multi::peer_info, setenv_int(), setenv_str(), and string_alloc().
Referenced by key_method_2_read(), test_acc_common_protocols(), and test_acc_send_message().
| struct buffer get_list_intersection | ( | struct gc_arena * | gc, |
| const char * | list1, | ||
| const char * | list2 ) |
Calculates the intersection of two list that are both separated by : Items in the result will have the same ordering as in the list1 parameters.
| gc | Returned buffer will be allocated in this gc |
| list1 | First list to intersect |
| list2 | Second list to intersect. |
Definition at line 351 of file acc.c.
References alloc_buf_gc(), buf_cstr(), buf_len(), buf_printf(), buf_write_u8(), gc, get_list_intersection(), min_size(), string_alloc(), strtok_r(), and tls_item_in_cipher_list().
Referenced by add_option(), determine_common_acc_protocols(), get_list_intersection(), parse_server_pushed_info_acc(), and test_list_intersection().
| void notify_client_acc_protocols | ( | struct tls_multi * | multi | ) |
Notifies a client via management interface of the negotiated app custom protocols.
| multi | the tls_multi instance of the connection |
Definition at line 436 of file acc.c.
References tls_multi::acc_max_message_length, tls_multi::acc_negotiated_protocols, M_CLIENT, and msg.
Referenced by do_deferred_options(), and parse_server_pushed_info_acc().
| int parse_acc_message_flags | ( | const char * | flags, |
| const char ** | err_reason, | ||
| struct gc_arena * | gc ) |
Parses the flags field of an app control message If there is an error parsing the flags field the method returns -1 and puts the error reason in err_reason.
Definition at line 91 of file acc.c.
References ACC_MESSAGE_FLAGS_ASCII, ACC_MESSAGE_FLAGS_BASE64, ACC_MESSAGE_FLAGS_FRAGMENT, man_def_auth_context::flags, gc, and gc_malloc().
Referenced by management_send_acc_message(), and parse_acc_message_flags_buf().
| char * parse_acc_parameters | ( | const char * | capabilities, |
| const char * | delim, | ||
| int * | max_acc_len, | ||
| bool | server, | ||
| struct gc_arena * | gc ) |
Parses an info message from the server that contains app custom control info information prior to the PUSH_REPLY to be able to use app custom control protocols before sending.
In client mode only allow what we support ourselves. In server mode allow also capabilities that we not support ourselves.
| capabilities | The string to parse |
| delim | The delimiter to use when parsing the string. IV_ACC uses "," as delimiter while the custom-control PUSH message uses " " as "," is already used to separate different push directives |
| max_acc_len | Set to the maximum ACC message length |
| server | Whether we are server or client |
| gc | The gc arena to use for allocating the resulting string |
Definition at line 287 of file acc.c.
References ACC_MAX_MSG_LEN, ACC_MIN_MSG_LEN, atoi_constrained(), D_PUSH_ERRORS, gc, min_int(), msg, string_alloc(), strtok_r(), and tls_item_in_cipher_list().
Referenced by determine_common_acc_protocols(), parse_server_pushed_info_acc(), and test_parse_acc_parameters().
This method parses an app custom control message and delivers it to the management interface.
We leave reassembly of fragmented messages to the management interface.
| c | The context struct |
| buffer | Buffer containing the control message with ACC |
Definition at line 152 of file acc.c.
References tls_multi::acc_negotiated_protocols, alloc_buf_gc(), atoi_constrained(), BLEN, buf_advance(), buf_cstr(), buf_extract_field(), buf_len(), buf_printf(), buf_read_u8(), context::c2, CBPTR, D_PUSH_ERRORS, format_hex(), gc, gc_free(), gc_malloc(), gc_new(), log_acc_message(), msg, parse_acc_message_flags_buf(), TLS_CHANNEL_BUF_SIZE, tls_item_in_cipher_list(), and context_2::tls_multi.
Referenced by parse_incoming_control_channel_command(), and test_acc_parse_client_messages().
| bool send_acc_message | ( | struct context * | c, |
| struct tls_multi * | tls_multi, | ||
| struct tls_session * | session, | ||
| const char * | protocol, | ||
| bool | fragment, | ||
| const char * | msg, | ||
| bool | base64 ) |
Definition at line 240 of file acc.c.
References tls_multi::acc_max_message_length, alloc_buf_gc(), BSTR, buf_printf(), D_PUSH, gc, gc_free(), gc_new(), buffer::len, M_CLIENT, msg, reschedule_multi_process(), send_control_channel_string_dowork(), and TLS_CHANNEL_BUF_SIZE.
Referenced by management_send_acc_message(), and test_acc_send_message().