OpenVPN
|
#include <winsock2.h>
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
#include "../tapctl/basic.h"
Go to the source code of this file.
Data Structures | |
struct | openvpn_service_t |
struct | settings_t |
Macros | |
#define | UNICODE |
#define | APPNAME TEXT(PACKAGE) TEXT("serv") |
#define | SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0") |
#define | MSG_FLAGS_ERROR (1<<0) |
#define | MSG_FLAGS_SYS_CODE (1<<1) |
#define | M_INFO (0) /* informational */ |
#define | M_SYSERR (MSG_FLAGS_ERROR|MSG_FLAGS_SYS_CODE) /* error + system code */ |
#define | M_ERR (MSG_FLAGS_ERROR) /* error */ |
#define | MAX_NAME 256 |
Enumerations | |
enum | openvpn_service_type { interactive , _service_max } |
Functions | |
VOID WINAPI | ServiceStartInteractiveOwn (DWORD argc, LPTSTR *argv) |
VOID WINAPI | ServiceStartInteractive (DWORD argc, LPTSTR *argv) |
DWORD | GetOpenvpnSettings (settings_t *s) |
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE service, SERVICE_STATUS *status) |
LPCTSTR | GetLastErrorText (void) |
DWORD | MsgToEventLog (DWORD flags, LPCTSTR lpszMsg,...) |
wchar_t * | utf8to16_size (const char *utf8, int size) |
Convert a UTF-8 string to UTF-16. | |
static wchar_t * | utf8to16 (const char *utf8) |
Convert a zero terminated UTF-8 string to UTF-16. | |
const wchar_t * | get_win_sys_path (void) |
Variables | |
openvpn_service_t | interactive_service |
LPCTSTR | service_instance |
#define M_ERR (MSG_FLAGS_ERROR) /* error */ |
#define M_SYSERR (MSG_FLAGS_ERROR|MSG_FLAGS_SYS_CODE) /* error + system code */ |
#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0") |
enum openvpn_service_type |
const wchar_t * get_win_sys_path | ( | void | ) |
Definition at line 1113 of file win32.c.
References ASSERT, win_sys_path, and win_sys_path.
Referenced by add_route(), delete_route(), do_dns_domain_wmic(), do_ifconfig_ipv6(), env_block(), HandleEnableDHCPMessage(), ipconfig_register_dns(), netsh_delete_address_dns(), netsh_dns_cmd(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), netsh_wins_cmd(), RegisterDNS(), and wmic_nicconfig_cmd().
LPCTSTR GetLastErrorText | ( | void | ) |
Definition at line 184 of file common.c.
Referenced by CmdInstallServices(), CmdRemoveServices(), CmdStartService(), and MsgToEventLog().
DWORD GetOpenvpnSettings | ( | settings_t * | s | ) |
Definition at line 56 of file common.c.
References settings_t::append, settings_t::config_dir, settings_t::exe_path, settings_t::ext_string, GetRegString(), settings_t::log_dir, M_ERR, M_SYSERR, MsgToEventLog(), settings_t::ovpn_admin_group, OVPN_ADMIN_GROUP, settings_t::priority, service_instance, and status.
Referenced by ServiceStartInteractive().
DWORD MsgToEventLog | ( | DWORD | flags, |
LPCTSTR | lpszMsg, | ||
... | |||
) |
Definition at line 215 of file common.c.
References APPNAME, GetLastErrorText(), msg, MSG_FLAGS_ERROR, MSG_FLAGS_SYS_CODE, and service_instance.
Referenced by _tmain(), BlockDNSErrHandler(), ConvertInterfaceNameToIndex(), CreateClientPipeInstance(), DeleteWfpBlock(), DuplicateAndMapRing(), ExecCommand(), GetOpenvpnSettings(), GetRegString(), GetStartupData(), GetTokenGroups(), HandleMessage(), HandleRegisterRingBuffers(), IsAuthorizedUser(), IsUserInGroup(), OvpnDuplicateHandle(), RegisterDNS(), ReportStatusToSCMgr(), ReturnError(), RunOpenvpn(), and ServiceStartInteractive().
BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE | service, |
SERVICE_STATUS * | status | ||
) |
Definition at line 22 of file service.c.
References MSG_FLAGS_ERROR, MsgToEventLog(), service, and status.
Referenced by ServiceCtrlInteractive(), and ServiceStartInteractive().
VOID WINAPI ServiceStartInteractive | ( | DWORD | argc, |
LPTSTR * | argv | ||
) |
Definition at line 2265 of file interactive.c.
References AddListItem(), CloseHandleEx(), CmpHandle(), CreateClientPipeInstance(), exit_event, FreeWaitHandles(), GetOpenvpnSettings(), InitOverlapped(), interactive_service, M_SYSERR, MsgToEventLog(), openvpn_service_t::name, rdns_semaphore, RemoveListItem(), ReportStatusToSCMgr(), ResetOverlapped(), ReturnError(), RunOpenvpn(), service, ServiceCtrlInteractive(), settings, status, and UpdateWaitHandles().
Referenced by _tmain(), and ServiceStartInteractiveOwn().
VOID WINAPI ServiceStartInteractiveOwn | ( | DWORD | argc, |
LPTSTR * | argv | ||
) |
Definition at line 2257 of file interactive.c.
References ServiceStartInteractive(), and status.
Referenced by _tmain().
|
inlinestatic |
Convert a zero terminated UTF-8 string to UTF-16.
This is just a wrapper function that always passes -1 as string size to utf8to16_size.
utf8 | const string to be converted |
Definition at line 123 of file service.h.
References utf8to16_size().
Referenced by HandleDNSConfigMessage(), HandleWINSConfigMessage(), InterfaceLuid(), and SetDNSDomain().
wchar_t * utf8to16_size | ( | const char * | utf8, |
int | size | ||
) |
Convert a UTF-8 string to UTF-16.
The size parameter can be used to convert strings which contain inline NUL characters, like MULTI_SZ strings used as values in the registry do, or (sub)strings that are not zero terminated. If size is -1 the length of the string is determined automatically by the WIN32 API. Make sure you pass a terminated string or else bad things will happen. Note that the size you pass should always include the terminating zero as well.
If the returned string is not NULL it must be freed by the caller.
utf8 | const string to be converted |
size | the size of the string |
Definition at line 251 of file common.c.
Referenced by utf8to16().
|
extern |
Definition at line 61 of file interactive.c.
Referenced by _tmain(), and ServiceStartInteractive().
|
extern |
Definition at line 27 of file common.c.
Referenced by _tmain(), CreateClientPipeInstance(), GetOpenvpnSettings(), GetRegString(), MsgToEventLog(), and RunOpenvpn().