|
OpenVPN
|
#include "tap.h"#include "error.h"#include <objbase.h>#include <setupapi.h>#include <stdio.h>#include <wchar.h>
Go to the source code of this file.
Functions | |
| static void | usage (void) |
| Print the help message. | |
| static struct tap_adapter_node * | find_adapter_by_name (LPCWSTR name, struct tap_adapter_node *adapter_list) |
| Locate an adapter node by its friendly name within the enumerated list. | |
| static BOOL | registry_name_exists (LPCWSTR name) |
| Check whether the registry still reserves a given network-connection name. | |
| static BOOL | tap_name_in_use (LPCWSTR name, struct tap_adapter_node *adapter_list) |
| Determine whether a friendly name is currently in use by an adapter or reserved in the registry. | |
| BOOL | tap_is_valid_adapter_name (LPCWSTR name) |
| Check whether a proposed adapter name satisfies Windows connection-name rules. | |
| static LPWSTR | tap_resolve_adapter_name (LPCWSTR requested_name, LPCWSTR hwid, struct tap_adapter_node *adapter_list) |
| Resolve the adapter name we should apply: | |
| static int | command_create (int argc, LPCWSTR argv[], BOOL *bRebootRequired) |
| static int | command_list (int argc, LPCWSTR argv[]) |
| static int | command_delete (int argc, LPCWSTR argv[], BOOL *bRebootRequired) |
| int __cdecl | wmain (int argc, LPCWSTR argv[]) |
| Program entry point. | |
| bool | dont_mute (unsigned int flags) |
| Check muting filter. | |
| void | x_msg_va (const unsigned int flags, const char *format, va_list arglist) |
Variables | |
| const WCHAR | title_string [] |
| static const WCHAR | usage_message [] |
| static const WCHAR | usage_message_create [] |
| static const WCHAR | usage_message_list [] |
| static const WCHAR | usage_message_delete [] |
|
static |
Definition at line 393 of file main.c.
References cleanup(), tap_adapter_node::szName, tap_create_adapter(), tap_delete_adapter(), tap_free_adapter_list(), tap_list_adapters(), tap_resolve_adapter_name(), and tap_set_adapter_name().
Referenced by wmain().
|
static |
Definition at line 556 of file main.c.
References tap_adapter_node::pNext, tap_delete_adapter(), tap_free_adapter_list(), and tap_list_adapters().
Referenced by wmain().
|
static |
Definition at line 505 of file main.c.
References _L, tap_adapter_node::pNext, tap_free_adapter_list(), and tap_list_adapters().
Referenced by wmain().
|
static |
Locate an adapter node by its friendly name within the enumerated list.
| name | Friendly name to search for. Comparison is case-insensitive. |
| adapter_list | Head of the adapter list returned by tap_list_adapters(). |
Definition at line 136 of file main.c.
References tap_adapter_node::pNext.
Referenced by tap_name_in_use(), and tap_resolve_adapter_name().
|
static |
Check whether the registry still reserves a given network-connection name.
Windows keeps friendly names under \HKLM\SYSTEM\CurrentControlSet\Control\Network\{NETCLASS}\{GUID}\Connection\Name, even after an adapter is removed. netsh refuses to rename to any reserved name.
| name | Friendly name to test. |
Definition at line 161 of file main.c.
Referenced by tap_name_in_use(), and tap_resolve_adapter_name().
| BOOL tap_is_valid_adapter_name | ( | LPCWSTR | name | ) |
Check whether a proposed adapter name satisfies Windows connection-name rules.
Tabs, control characters (except space), and the following characters are disallowed: \ / : * ? " < > | Names must also be non-empty and no longer than 255 characters.
Definition at line 261 of file main.c.
Referenced by tap_resolve_adapter_name().
|
static |
Determine whether a friendly name is currently in use by an adapter or reserved in the registry.
| name | Friendly name to test. |
| adapter_list | Head of the adapter list returned by tap_list_adapters(). |
Definition at line 238 of file main.c.
References find_adapter_by_name(), and registry_name_exists().
Referenced by tap_resolve_adapter_name().
|
static |
Resolve the adapter name we should apply:
| requested_name | Name provided via CLI or configuration (may be NULL/empty). |
| hwid | Hardware identifier of the adapter being created. |
| adapter_list | Existing adapters enumerated via tap_list_adapters(). |
Definition at line 306 of file main.c.
References _L, find_adapter_by_name(), tap_adapter_node::guid, registry_name_exists(), tap_adapter_node::szName, tap_is_valid_adapter_name(), and tap_name_in_use().
Referenced by command_create().
|
static |
Print the help message.
Definition at line 122 of file main.c.
References title_string, and usage_message.
Referenced by wmain().
| int __cdecl wmain | ( | int | argc, |
| LPCWSTR | argv[] | ||
| ) |
Program entry point.
Definition at line 612 of file main.c.
References command_create(), command_delete(), command_list(), title_string, usage(), usage_message_create, usage_message_delete, and usage_message_list.
| void x_msg_va | ( | const unsigned int | flags, |
| const char * | format, | ||
| va_list | arglist | ||
| ) |
| const WCHAR title_string[] |
|
static |
Definition at line 44 of file main.c.
Referenced by usage().
|
static |
Definition at line 61 of file main.c.
Referenced by wmain().
|
static |
|
static |
Definition at line 87 of file main.c.
Referenced by wmain().