本文整理汇总了C++中FreeBuf函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeBuf函数的具体用法?C++ FreeBuf怎么用?C++ FreeBuf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeBuf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CfgTest
void CfgTest()
{
#if 0
FOLDER *root;
BUF *b;
Debug("\nCFG Test Begin\n");
root = CfgCreateFolder(NULL, TAG_ROOT);
CfgTest2(root, 5);
b = CfgFolderToBufText(root);
//Print("%s\n", b->Buf);
SeekBuf(b, 0, 0);
CfgDeleteFolder(root);
DumpBuf(b, "test1.config");
root = CfgBufTextToFolder(b);
FreeBuf(b);
b = CfgFolderToBufText(root);
// Print("%s\n", b->Buf);
DumpBuf(b, "test2.config");
FreeBuf(b);
CfgSave(root, "test.txt");
CfgDeleteFolder(root);
Debug("\nCFG Test End\n");
#endif
}
开发者ID:BIGbozi,项目名称:SoftEtherVPN,代码行数:34,代码来源:Cfg.c
示例2: StrToMac
// Convert the string to a MAC address
bool StrToMac(UCHAR *mac_address, char *str)
{
BUF *b;
// Validate arguments
if (mac_address == NULL || str == NULL)
{
return false;
}
b = StrToBin(str);
if (b == NULL)
{
return false;
}
if (b->Size != 6)
{
FreeBuf(b);
return false;
}
Copy(mac_address, b->Buf, 6);
FreeBuf(b);
return true;
}
开发者ID:SoftEtherVPN,项目名称:SoftEtherVPN,代码行数:28,代码来源:Str.c
示例3: ViExtractCabinetFile
// Extract the Cabinet file from the EXE file
bool ViExtractCabinetFile(char *exe, char *cab)
{
BUF *b;
// Validate arguments
if (exe == NULL || cab == NULL)
{
return false;
}
b = ViExtractResource(exe, RT_RCDATA, "CABINET");
if (b == NULL)
{
return false;
}
if (DumpBuf(b, cab) == false)
{
FreeBuf(b);
return false;
}
FreeBuf(b);
return true;
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:27,代码来源:vpninstall.c
示例4: PackError
PACK *WpcCallEx(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm,
char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, bool *cancel, UINT max_recv_size,
char *additional_header_name, char *additional_header_value)
{
URL_DATA data;
BUF *b, *recv;
UINT error;
WPC_PACKET packet;
// Validate arguments
if (function_name == NULL || pack == NULL)
{
return PackError(ERR_INTERNAL_ERROR);
}
if (ParseUrl(&data, url, true, NULL) == false)
{
return PackError(ERR_INTERNAL_ERROR);
}
PackAddStr(pack, "function", function_name);
b = WpcGeneratePacket(pack, cert, key);
if (b == NULL)
{
return PackError(ERR_INTERNAL_ERROR);
}
SeekBuf(b, b->Size, 0);
WriteBufInt(b, 0);
SeekBuf(b, 0, 0);
if (IsEmptyStr(additional_header_name) == false && IsEmptyStr(additional_header_value) == false)
{
StrCpy(data.AdditionalHeaderName, sizeof(data.AdditionalHeaderName), additional_header_name);
StrCpy(data.AdditionalHeaderValue, sizeof(data.AdditionalHeaderValue), additional_header_value);
}
recv = HttpRequestEx(&data, setting, timeout_connect, timeout_comm, &error,
false, b->Buf, NULL, NULL, sha1_cert_hash, cancel, max_recv_size);
FreeBuf(b);
if (recv == NULL)
{
return PackError(error);
}
if (WpcParsePacket(&packet, recv) == false)
{
FreeBuf(recv);
return PackError(ERR_PROTOCOL_ERROR);
}
FreeBuf(recv);
FreeX(packet.Cert);
return packet.Pack;
}
开发者ID:BIGbozi,项目名称:SoftEtherVPN,代码行数:59,代码来源:Wpc.c
示例5: SaveUnicodeCache
// Save the Unicode cache
void SaveUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash)
{
UNICODE_CACHE c;
BUF *b;
UINT i;
IO *io;
wchar_t name[MAX_PATH];
UCHAR binhash[MD5_SIZE];
// Validate arguments
if (strfilename == NULL || hash == NULL)
{
return;
}
Zero(&c, sizeof(c));
UniToStr(c.StrFileName, sizeof(c.StrFileName), strfilename);
c.StrFileSize = strfilesize;
GetMachineName(c.MachineName, sizeof(c.MachineName));
c.OsType = GetOsInfo()->OsType;
Copy(c.hash, hash, MD5_SIZE);
#ifdef OS_UNIX
GetCurrentCharSet(c.CharSet, sizeof(c.CharSet));
#else // OS_UNIX
{
UINT id = MsGetThreadLocale();
Copy(c.CharSet, &id, sizeof(id));
}
#endif // OS_UNIX
b = NewBuf();
WriteBuf(b, &c, sizeof(c));
WriteBufInt(b, LIST_NUM(TableList));
for (i = 0;i < LIST_NUM(TableList);i++)
{
TABLE *t = LIST_DATA(TableList, i);
WriteBufInt(b, StrLen(t->name));
WriteBuf(b, t->name, StrLen(t->name));
WriteBufInt(b, StrLen(t->str));
WriteBuf(b, t->str, StrLen(t->str));
WriteBufInt(b, UniStrLen(t->unistr));
WriteBuf(b, t->unistr, UniStrLen(t->unistr) * sizeof(wchar_t));
}
Hash(binhash, b->Buf, b->Size, false);
WriteBuf(b, binhash, MD5_SIZE);
GenerateUnicodeCacheFileName(name, sizeof(name), strfilename, strfilesize, hash);
io = FileCreateW(name);
if (io != NULL)
{
SeekBuf(b, 0, 0);
BufToFile(io, b);
FileClose(io);
}
FreeBuf(b);
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:61,代码来源:Table.c
示例6: BM_Free
void BM_Free(void *hBuf, u32 ui32Flags)
{
struct BM_BUF *pBuf = (struct BM_BUF *)hBuf;
struct SYS_DATA *psSysData;
struct IMG_SYS_PHYADDR sHashAddr;
PVR_DPF(PVR_DBG_MESSAGE, "BM_Free (h=%08X)", hBuf);
PVR_ASSERT(pBuf != NULL);
if (pBuf == NULL) {
PVR_DPF(PVR_DBG_ERROR, "BM_Free: invalid parameter");
return;
}
if (SysAcquireData(&psSysData) != PVRSRV_OK)
return;
pBuf->ui32RefCount--;
if (pBuf->ui32RefCount == 0) {
struct BM_MAPPING *map = pBuf->pMapping;
struct BM_CONTEXT *ctx = map->pBMHeap->pBMContext;
if (map->eCpuMemoryOrigin == hm_wrapped ||
map->eCpuMemoryOrigin == hm_wrapped_virtaddr) {
sHashAddr = SysCpuPAddrToSysPAddr(pBuf->CpuPAddr);
HASH_Remove(ctx->pBufferHash, (u32)sHashAddr.uiAddr);
}
FreeBuf(pBuf, ui32Flags);
pvr_put_ctx(ctx);
}
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan-1,代码行数:33,代码来源:buffer_manager.c
示例7: LoadTableW
bool LoadTableW(wchar_t *filename)
{
bool ret;
BUF *b;
wchar_t replace_name[MAX_PATH];
Zero(replace_name, sizeof(replace_name));
TrackingDisable();
b = ReadDump("@table_name.txt");
if (b != NULL)
{
char *s = CfgReadNextLine(b);
if (s != NULL)
{
if (IsEmptyStr(s) == false)
{
StrToUni(replace_name, sizeof(replace_name), s);
filename = replace_name;
}
Free(s);
}
FreeBuf(b);
}
ret = LoadTableMain(filename);
TrackingEnable();
return ret;
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:33,代码来源:Table.c
示例8: NsGenMacAddressSignatureForMachine
// Determine the last two bytes of the MAC address
void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4)
{
char machine_name[MAX_SIZE];
BUF *b;
UCHAR hash[SHA1_SIZE];
// Validate arguments
if (dst_last_2 == NULL || src_mac_addr_4 == NULL)
{
return;
}
GetMachineHostName(machine_name, sizeof(machine_name));
Trim(machine_name);
StrUpper(machine_name);
b = NewBuf();
WriteBuf(b, src_mac_addr_4, 4);
WriteBufStr(b, machine_name);
HashSha1(hash, b->Buf, b->Size);
FreeBuf(b);
Copy(dst_last_2, hash, 2);
}
开发者ID:AquilesCrespo,项目名称:SoftEtherVPN,代码行数:27,代码来源:NativeStack.c
示例9: WriteTinyLog
// Write to tiny log
void WriteTinyLog(TINY_LOG *t, char *str)
{
BUF *b;
char dt[MAX_PATH];
// Validate arguments
if (t == NULL)
{
return;
}
GetDateTimeStrMilli64(dt, sizeof(dt), LocalTime64());
StrCat(dt, sizeof(dt), ": ");
b = NewBuf();
WriteBuf(b, dt, StrLen(dt));
WriteBuf(b, str, StrLen(str));
WriteBuf(b, "\r\n", 2);
Lock(t->Lock);
{
FileWrite(t->io, b->Buf, b->Size);
//FileFlush(t->io);
}
Unlock(t->Lock);
FreeBuf(b);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:29,代码来源:Cedar.c
示例10: NewBuf
// Build the Attribute list
BUF *SstpBuildAttributeList(LIST *o, USHORT message_type)
{
UINT i;
BUF *b;
USHORT us;
// Validate arguments
if (o == NULL)
{
return NULL;
}
b = NewBuf();
us = Endian16(message_type);
WriteBuf(b, &us, sizeof(USHORT));
us = Endian16((USHORT)LIST_NUM(o));
WriteBuf(b, &us, sizeof(USHORT));
for (i = 0;i < LIST_NUM(o);i++)
{
SSTP_ATTRIBUTE *a = LIST_DATA(o, i);
BUF *ab = SstpBuildAttribute(a);
if (ab != NULL)
{
WriteBufBuf(b, ab);
FreeBuf(ab);
}
}
return b;
}
开发者ID:DreamLiMu,项目名称:SoftEtherVPN,代码行数:35,代码来源:Interop_SSTP.c
示例11: ViExtractResource
// Extract the license agreement from the EXE file
wchar_t *ViExtractEula(char *exe)
{
BUF *b;
UINT tmp_size;
char *tmp;
wchar_t *ret;
// Validate arguments
if (exe == NULL)
{
return false;
}
b = ViExtractResource(exe, RT_RCDATA, "LICENSE");
if (b == NULL)
{
return NULL;
}
tmp_size = b->Size + 1;
tmp = ZeroMalloc(tmp_size);
Copy(tmp, b->Buf, b->Size);
FreeBuf(b);
ret = CopyStrToUni(tmp);
Free(tmp);
return ret;
}
开发者ID:alex-docker,项目名称:CE-dockerfiles,代码行数:30,代码来源:vpninstall.c
示例12: NullGenerateMacAddress
// Generate MAC address
void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq)
{
UCHAR hash[SHA1_SIZE];
char name[MAX_SIZE];
BUF *b;
// Validate arguments
if (mac == NULL)
{
return;
}
b = NewBuf();
WriteBufInt(b, id);
WriteBufInt(b, seq);
GetMachineHostName(name, sizeof(name));
#ifdef OS_WIN32
WriteBufInt(b, MsGetCurrentProcessId());
#endif // OS_WIN32
WriteBufStr(b, name);
HashSha1(hash, b->Buf, b->Size);
FreeBuf(b);
Copy(mac, hash, 6);
mac[0] = 0x7E;
}
开发者ID:m-a-n-a-v,项目名称:SoftEtherVPN_Stable,代码行数:28,代码来源:NullLan.c
示例13: PackToBuf
// Generate the packet
BUF *WpcGeneratePacket(PACK *pack, X *cert, K *key)
{
UCHAR hash[SHA1_SIZE];
BUF *pack_data;
BUF *cert_data = NULL;
BUF *sign_data = NULL;
BUF *b;
// Validate arguments
if (pack == NULL)
{
return NULL;
}
pack_data = PackToBuf(pack);
HashSha1(hash, pack_data->Buf, pack_data->Size);
if (cert != NULL && key != NULL)
{
UCHAR sign[128];
cert_data = XToBuf(cert, false);
RsaSign(sign, hash, sizeof(hash), key);
sign_data = NewBuf();
WriteBuf(sign_data, sign, sizeof(sign));
SeekBuf(sign_data, 0, 0);
}
b = NewBuf();
WpcAddDataEntryBin(b, "PACK", pack_data->Buf, pack_data->Size);
WpcAddDataEntryBin(b, "HASH", hash, sizeof(hash));
if (cert_data != NULL)
{
WpcAddDataEntryBin(b, "CERT", cert_data->Buf, cert_data->Size);
WpcAddDataEntryBin(b, "SIGN", sign_data->Buf, sign_data->Size);
}
FreeBuf(pack_data);
FreeBuf(cert_data);
FreeBuf(sign_data);
SeekBuf(b, 0, 0);
return b;
}
开发者ID:BIGbozi,项目名称:SoftEtherVPN,代码行数:48,代码来源:Wpc.c
示例14: NullToken
// Cut out the token from the string (not ignore the blanks between delimiters)
TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars)
{
LIST *o;
UINT i, len;
BUF *b;
char zero = 0;
TOKEN_LIST *t;
// Validate arguments
if (str == NULL)
{
return NullToken();
}
if (split_chars == NULL)
{
split_chars = DefaultTokenSplitChars();
}
b = NewBuf();
o = NewListFast(NULL);
len = StrLen(str);
for (i = 0;i < (len + 1);i++)
{
char c = str[i];
bool flag = IsCharInStr(split_chars, c);
if (c == '\0')
{
flag = true;
}
if (flag == false)
{
WriteBuf(b, &c, sizeof(char));
}
else
{
WriteBuf(b, &zero, sizeof(char));
Insert(o, CopyStr((char *)b->Buf));
ClearBuf(b);
}
}
t = ZeroMalloc(sizeof(TOKEN_LIST));
t->NumTokens = LIST_NUM(o);
t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens);
for (i = 0;i < t->NumTokens;i++)
{
t->Token[i] = LIST_DATA(o, i);
}
ReleaseList(o);
FreeBuf(b);
return t;
}
开发者ID:SoftEtherVPN,项目名称:SoftEtherVPN,代码行数:60,代码来源:Str.c
示例15: NsIpTablesThread
// iptables thread
void NsIpTablesThread(THREAD *thread, void *param)
{
IPTABLES_STATE *state;
NATIVE_STACK *s;
UINT counter = 0;
BUF *seed_buf;
char exe_name[MAX_PATH];
if (thread == NULL || param == NULL)
{
return;
}
s = (NATIVE_STACK *)param;
seed_buf = NewBuf();
WriteBuf(seed_buf, s->MacAddress, 6);
GetExeName(exe_name, sizeof(exe_name));
WriteBufStr(seed_buf, exe_name);
state = StartAddIpTablesEntryForNativeStack(seed_buf->Buf, seed_buf->Size);
FreeBuf(seed_buf);
if (state == NULL)
{
NoticeThreadInit(thread);
return;
}
s->IpTablesInitOk = true;
NoticeThreadInit(thread);
while (true)
{
UINT wait_interval;
if (s->IpTablesHalt)
{
break;
}
if (MaintainAddIpTablesEntryForNativeStack(state))
{
counter = 0;
}
counter++;
wait_interval = NS_CHECK_IPTABLES_INTERVAL_INIT * counter;
wait_interval = MIN(wait_interval, NS_CHECK_IPTABLES_INTERVAL_MAX);
//Debug("NsIpTablesThread: wait for %u\n", wait_interval);
Wait(s->IpTablesHaltEvent, wait_interval);
}
EndAddIpTablesEntryForNativeStack(state);
}
开发者ID:52M,项目名称:SoftEtherVPN,代码行数:59,代码来源:NativeStack.c
示例16: SelectAvail
void GrabberContext::freeReleasedBufs() {
QList<AllocatedBuf>::iterator avails = std::remove_if(
_allocatedBufs.begin(), _allocatedBufs.end(), SelectAvail());
if (avails != _allocatedBufs.end()) {
std::for_each(avails, _allocatedBufs.end(), FreeBuf());
_allocatedBufs.erase(avails, _allocatedBufs.end());
}
}
开发者ID:dreamer-dead,项目名称:MyLightpack,代码行数:9,代码来源:GrabberContext.cpp
示例17: sizeof
// Read the certificate object
X *ReadSecCertFromObject(SECURE *sec, SEC_OBJ *obj)
{
UINT size;
X *x;
UCHAR value[4096];
BUF *b;
CK_ATTRIBUTE get[] =
{
{CKA_VALUE, value, sizeof(value)},
};
// Validate arguments
if (sec == NULL)
{
return false;
}
if (sec->SessionCreated == false)
{
sec->Error = SEC_ERROR_NO_SESSION;
return false;
}
if (sec->LoginFlag == false && obj->Private)
{
sec->Error = SEC_ERROR_NOT_LOGIN;
return false;
}
if (obj->Type != SEC_X)
{
sec->Error = SEC_ERROR_BAD_PARAMETER;
return false;
}
// Acquisition
if (sec->Api->C_GetAttributeValue(
sec->SessionId, obj->Object, get, sizeof(get) / sizeof(get[0])) != CKR_OK)
{
sec->Error = SEC_ERROR_HARDWARE_ERROR;
return 0;
}
size = A_SIZE(get, 0);
// Conversion
b = NewBuf();
WriteBuf(b, value, size);
SeekBuf(b, 0, 0);
x = BufToX(b, false);
if (x == NULL)
{
sec->Error = SEC_ERROR_INVALID_CERT;
}
FreeBuf(b);
return x;
}
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:57,代码来源:Secure.c
示例18: NiWriteConfig
// Write the configuration to a file
void NiWriteConfig(NAT *n)
{
// Validate arguments
if (n == NULL)
{
return;
}
Lock(n->lock);
{
FOLDER *root = CfgCreateFolder(NULL, TAG_ROOT);
BUF *b;
// Certificate
b = XToBuf(n->AdminX, false);
CfgAddBuf(root, "AdminCert", b);
FreeBuf(b);
// Secret key
b = KToBuf(n->AdminK, false, NULL);
CfgAddBuf(root, "AdminKey", b);
FreeBuf(b);
// Password
CfgAddByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword));
CfgAddInt(root, "AdminPort", n->AdminPort);
CfgAddBool(root, "Online", n->Online);
// Virtual host option
NiWriteVhOption(n, root);
// Connection options
if (n->ClientOption != NULL && n->ClientAuth != NULL)
{
NiWriteClientData(n, root);
}
SaveCfgRw(n->CfgRw, root);
CfgDeleteFolder(root);
}
Unlock(n->lock);
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:43,代码来源:Nat.c
示例19: NiWriteConfig
// 設定をファイルに書き込む
void NiWriteConfig(NAT *n)
{
// 引数チェック
if (n == NULL)
{
return;
}
Lock(n->lock);
{
FOLDER *root = CfgCreateFolder(NULL, TAG_ROOT);
BUF *b;
// 証明書
b = XToBuf(n->AdminX, false);
CfgAddBuf(root, "AdminCert", b);
FreeBuf(b);
// 秘密鍵
b = KToBuf(n->AdminK, false, NULL);
CfgAddBuf(root, "AdminKey", b);
FreeBuf(b);
// パスワード
CfgAddByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword));
CfgAddInt(root, "AdminPort", n->AdminPort);
CfgAddBool(root, "Online", n->Online);
// 仮想ホストオプション
NiWriteVhOption(n, root);
// 接続オプション
if (n->ClientOption != NULL && n->ClientAuth != NULL)
{
NiWriteClientData(n, root);
}
SaveCfgRw(n->CfgRw, root);
CfgDeleteFolder(root);
}
Unlock(n->lock);
}
开发者ID:falcon8823,项目名称:utvpn,代码行数:43,代码来源:Nat.c
示例20: IPsecWin7UpdateHostIPAddressList
// Update the IP address list of the host
void IPsecWin7UpdateHostIPAddressList(IPSEC_WIN7 *w)
{
LIST *o;
UINT i;
BUF *buf;
UINT retsize;
// Validate arguments
if (w == NULL)
{
return;
}
o = GetHostIPAddressList();
if (o == NULL)
{
return;
}
buf = NewBuf();
for (i = 0;i < LIST_NUM(o);i++)
{
IP *ip = LIST_DATA(o, i);
WFP_LOCAL_IP a;
Zero(&a, sizeof(a));
// Exclude any IPs or localhost IP
if (IsZeroIP(ip) == false && IsLocalHostIP(ip) == false)
{
if (IsIP4(ip))
{
a.IpVersion = 4;
Copy(a.IpAddress.IPv4Address, ip->addr, 4);
}
else
{
a.IpVersion = 6;
Copy(a.IpAddress.IPv6Address, ip->ipv6_addr, 16);
}
WriteBuf(buf, &a, sizeof(WFP_LOCAL_IP));
}
}
if (WriteFile(w->hDriverFile, buf->Buf, buf->Size, &retsize, NULL) == false)
{
Debug("WriteFile to the driver failed. %u\n", GetLastError());
}
FreeHostIPAddressList(o);
FreeBuf(buf);
}
开发者ID:bjdag1234,项目名称:SoftEtherVPN,代码行数:55,代码来源:IPsec_Win7.c
注:本文中的FreeBuf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论