This is a common initialization module for the smbcp class of commands. It will perform a manual initialization, configuration, and startup of the stack if needed.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include <unistd.h>
#include <ofc/config.h>
#if !defined(INIT_ON_LOAD)
void smbcp_configure(void);
#endif
void smbcp_init(void)
{
#if defined(INIT_ON_LOAD)
#else
smbcp_configure();
#endif
}
#if !defined(INIT_ON_LOAD)
void disable_smb_dialects(void)
{
}
void generate_uuid(char *uuid)
{
const char *chars = "0123456789abcdef";
int i;
srand((unsigned int)time(NULL));
for (i = 0; i < 36; i++)
{
if (i == 8 || i == 13 || i == 18 || i == 23)
{
uuid[i] = '-';
}
else if (i == 14)
{
uuid[i] = '4';
}
else if (i == 19)
{
uuid[i] = chars[(rand() % 4) + 8];
}
else
{
uuid[i] = chars[rand() % 16];
}
}
uuid[36] = '\0';
}
void smbcp_configure(void)
{
#if defined(OFC_PERSIST)
#else
#if defined(SMBCP_NETWORK_AUTOCONFIG)
#else
ofc_pton(
"0.0.0.0", &iface.
ip);
ofc_pton(
"255.255.255.255", &iface.
bcast);
ofc_pton(
"0.0.0.0", &iface.
mask);
OFC_IPADDR winsaddr[2];
ofc_pton("192.168.1.61", &winsaddr[0]);
ofc_pton("192.168.1.62", &winsaddr[1]);
#endif
disable_smb_dialects();
generate_uuid(uuid);
#endif
}
#endif
void smbcp_deactivate(void)
{
#if !defined(INIT_ON_LOAD)
#endif
}
#define OFC_HANDLE_NULL
Definition: handle.h:64
OFC_CORE_LIB OFC_VOID ofc_framework_set_logging(OFC_UINT log_level, OFC_BOOL log_console)
OFC_CORE_LIB OFC_VOID ofc_framework_set_host_name(OFC_LPCTSTR name, OFC_LPCTSTR workgroup, OFC_LPCTSTR desc)
OFC_CORE_LIB OFC_VOID ofc_framework_load(OFC_LPCTSTR filename)
OFC_CORE_LIB OFC_VOID ofc_framework_set_netbios(OFC_BOOL enabled)
OFC_CORE_LIB OFC_VOID ofc_framework_destroy(OFC_VOID)
OFC_VOID ofc_framework_add_interface(OFC_FRAMEWORK_INTERFACE *iface)
OFC_CORE_LIB OFC_VOID ofc_framework_startup(OFC_VOID)
OFC_CORE_LIB OFC_VOID ofc_framework_shutdown(OFC_VOID)
@ OFC_CONFIG_HMODE
Definition: framework.h:143
OFC_CORE_LIB OFC_VOID ofc_framework_init(OFC_VOID)
OFC_VOID ofc_framework_set_realm(const OFC_CHAR *realm)
OFC_VOID ofc_framework_set_interface_discovery(OFC_BOOL on)
OFC_VOID ofc_framework_set_uuid(const OFC_CHAR *cuuid)
OF_SMB_LIB OFC_VOID of_smb_shutdown(OFC_VOID)
OF_SMB_LIB OFC_VOID of_smb_init(OFC_VOID)
OF_SMB_LIB OFC_VOID of_smb_enable_dialect(OFC_UINT dialect)
OF_SMB_LIB OFC_VOID of_smb_destroy(OFC_VOID)
OF_SMB_LIB OFC_VOID of_smb_disable_dialect(OFC_UINT dialect)
OF_SMB_LIB OFC_VOID of_smb_startup(OFC_HANDLE hScheduler)
Definition: framework.h:150
OFC_FRAMEWORK_WINSLIST wins
Definition: framework.h:156
OFC_IPADDR ip
Definition: framework.h:152
OFC_CONFIG_MODE netBiosMode
Definition: framework.h:151
OFC_IPADDR mask
Definition: framework.h:154
OFC_LPCSTR lmb
Definition: framework.h:155
OFC_IPADDR bcast
Definition: framework.h:153
OFC_IPADDR * winsaddr
Array of Wins IP addresses.
Definition: framework.h:129
OFC_INT num_wins
Number of Wins IP addresses.
Definition: framework.h:128
@ OFC_FALSE
Definition: types.h:632
@ OFC_TRUE
Definition: types.h:636
void OFC_VOID
Definition: types.h:159
@ OFC_LOG_INFO
Definition: types.h:649
#define OFC_NULL
Definition: types.h:656
char OFC_CHAR
Definition: types.h:143
#define TSTR(x)
Definition: types.h:534