本文整理汇总了C++中LIST_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ LIST_DATA函数的具体用法?C++ LIST_DATA怎么用?C++ LIST_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LIST_DATA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: L3FreeAllSw
// Stop all L3 switches in the Cedar
void L3FreeAllSw(CEDAR *c)
{
LIST *o;
UINT i;
// Validate arguments
if (c == NULL)
{
return;
}
o = NewListFast(NULL);
LockList(c->L3SwList);
{
for (i = 0;i < LIST_NUM(c->L3SwList);i++)
{
L3SW *s = LIST_DATA(c->L3SwList, i);
Insert(o, CopyStr(s->Name));
}
for (i = 0;i < LIST_NUM(o);i++)
{
char *name = LIST_DATA(o, i);
L3DelSw(c, name);
Free(name);
}
ReleaseList(o);
}
UnlockList(c->L3SwList);
}
示例2: CleanupL3Sw
// Clean-up the L3 switch
void CleanupL3Sw(L3SW *s)
{
UINT i;
// Validate arguments
if (s == NULL)
{
return;
}
for (i = 0;i < LIST_NUM(s->IfList);i++)
{
L3IF *f = LIST_DATA(s->IfList, i);
Free(f);
}
ReleaseList(s->IfList);
for (i = 0;i < LIST_NUM(s->TableList);i++)
{
L3TABLE *t = LIST_DATA(s->TableList, i);
Free(t);
}
ReleaseList(s->TableList);
DeleteLock(s->lock);
Free(s);
}
示例3: ElFreeConfig
// Configuration release
void ElFreeConfig(EL *e)
{
UINT i;
LIST *o;
// Validate arguments
if (e == NULL)
{
return;
}
// Write the configuration file
ElSaveConfig(e);
FreeCfgRw(e->CfgRw);
// Stop all capture
o = NewList(NULL);
LockList(e->DeviceList);
{
for (i = 0;i < LIST_NUM(e->DeviceList);i++)
{
EL_DEVICE *d = LIST_DATA(e->DeviceList, i);
Insert(o, CopyStr(d->DeviceName));
}
for (i = 0;i < LIST_NUM(o);i++)
{
char *name = LIST_DATA(o, i);
ElDeleteCaptureDevice(e, name);
Free(name);
}
ReleaseList(o);
}
UnlockList(e->DeviceList);
ReleaseList(e->DeviceList);
}
示例4: DeleteOldNoSsl
// Delete old entries in Non-SSL connection list
void DeleteOldNoSsl(CEDAR *c)
{
UINT i;
LIST *o;
// Validate arguments
if (c == NULL)
{
return;
}
o = NewListFast(NULL);
for (i = 0;i < LIST_NUM(c->NonSslList);i++)
{
NON_SSL *n = LIST_DATA(c->NonSslList, i);
if (n->EntryExpires <= Tick64())
{
Add(o, n);
}
}
for (i = 0;i < LIST_NUM(o);i++)
{
NON_SSL *n = LIST_DATA(o, i);
Delete(c->NonSslList, n);
Free(n);
}
ReleaseList(o);
}
示例5: Win32EthGetNameAndIdFromCombinedName
// Search adapter with the name
struct WP_ADAPTER *Win32EthSearch(char *name)
{
UINT i;
UINT id;
char simple_name[MAX_SIZE];
WP_ADAPTER *ret = NULL;
id = Win32EthGetNameAndIdFromCombinedName(simple_name, sizeof(simple_name), name);
if (id != 0)
{
UINT num_match = 0;
// Search with ID when ID is specified
for (i = 0;i < LIST_NUM(eth_list);i++)
{
WP_ADAPTER *a = LIST_DATA(eth_list, i);
if (a->Id != 0 && a->Id == id)
{
ret = a;
num_match++;
}
}
if (num_match >= 2)
{
// If the ID matches to 2 or more devices, search with the name
for (i = 0;i < LIST_NUM(eth_list);i++)
{
WP_ADAPTER *a = LIST_DATA(eth_list, i);
if (a->Id != 0 && a->Id == id)
{
if (StrCmpi(a->Title, name) == 0)
{
ret = a;
break;
}
}
}
}
}
else
{
// Search with name when ID is not specified
for (i = 0;i < LIST_NUM(eth_list);i++)
{
WP_ADAPTER *a = LIST_DATA(eth_list, i);
if (StrCmpi(a->Title, name) == 0)
{
ret = a;
break;
}
}
}
return ret;
}
示例6: L3FreeInterface
// Release the Layer-3 interface
void L3FreeInterface(L3IF *f)
{
UINT i;
L3PACKET *p;
PKT *pkt;
// Validate arguments
if (f == NULL)
{
return;
}
for (i = 0;i < LIST_NUM(f->ArpTable);i++)
{
L3ARPENTRY *a = LIST_DATA(f->ArpTable, i);
Free(a);
}
ReleaseList(f->ArpTable);
f->ArpTable = NULL;
for (i = 0;i < LIST_NUM(f->ArpWaitTable);i++)
{
L3ARPWAIT *w = LIST_DATA(f->ArpWaitTable, i);
Free(w);
}
ReleaseList(f->ArpWaitTable);
f->ArpWaitTable = NULL;
while (p = GetNext(f->IpPacketQueue))
{
Free(p->Packet->PacketData);
FreePacket(p->Packet);
Free(p);
}
ReleaseQueue(f->IpPacketQueue);
f->IpPacketQueue = NULL;
for (i = 0;i < LIST_NUM(f->IpWaitList);i++)
{
L3PACKET *p = LIST_DATA(f->IpWaitList, i);
Free(p->Packet->PacketData);
FreePacket(p->Packet);
Free(p);
}
ReleaseList(f->IpWaitList);
f->IpWaitList = NULL;
while (pkt = GetNext(f->SendQueue))
{
Free(pkt->PacketData);
FreePacket(pkt);
}
ReleaseQueue(f->SendQueue);
f->SendQueue = NULL;
}
示例7: EndAddIpTablesEntryForNativeStack
// Stop the iptables management
void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s)
{
UINT i;
if (s == NULL)
{
return;
}
// Delete entries
for (i = 0; i < LIST_NUM(s->EntryList);i++)
{
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
UINT j;
for (j = 0;j < 100;j++)
{
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0)
{
char cmdline[MAX_PATH];
Format(cmdline, sizeof(cmdline),
"iptables -D %s %s",
e->Chain, e->ConditionAndArgs);
system(cmdline);
}
else
{
break;
}
}
}
FreeIpTablesState(s);
}
示例8: 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;
}
示例9: DeleteCa
// Delete trusted CA from Cedar
bool DeleteCa(CEDAR *cedar, UINT ptr)
{
bool b = false;
// Validate arguments
if (cedar == NULL || ptr == 0)
{
return false;
}
LockList(cedar->CaList);
{
UINT i;
for (i = 0;i < LIST_NUM(cedar->CaList);i++)
{
X *x = LIST_DATA(cedar->CaList, i);
if (POINTER_TO_KEY(x) == ptr)
{
Delete(cedar->CaList, x);
FreeX(x);
b = true;
break;
}
}
}
UnlockList(cedar->CaList);
return b;
}
示例10: AddCa
// Add trusted CA to Cedar
void AddCa(CEDAR *cedar, X *x)
{
// Validate arguments
if (cedar == NULL || x == NULL)
{
return;
}
LockList(cedar->CaList);
{
UINT i;
bool ok = true;
for (i = 0;i < LIST_NUM(cedar->CaList);i++)
{
X *exist_x = LIST_DATA(cedar->CaList, i);
if (CompareX(exist_x, x))
{
ok = false;
break;
}
}
if (ok)
{
Insert(cedar->CaList, CloneX(x));
}
}
UnlockList(cedar->CaList);
}
示例11: CedarIsThereAnyEapEnabledRadiusConfig
// Check whether there is any EAP-enabled RADIUS configuration
bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c)
{
bool ret = false;
UINT i;
if (c == NULL)
{
return false;
}
LockHubList(c);
{
for (i = 0;i < LIST_NUM(c->HubList);i++)
{
HUB *hub = LIST_DATA(c->HubList, i);
if (hub->RadiusConvertAllMsChapv2AuthRequestToEap)
{
ret = true;
break;
}
}
}
UnlockHubList(c);
return ret;
}
示例12: IPToStr
// Search an entry
IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark)
{
char ip_str1[64];
char ip_str2[64];
char mark_str1[64];
char mark_str2[64];
UINT i;
if (s == NULL || chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0)
{
return NULL;
}
IPToStr(ip_str1, sizeof(ip_str1), src_ip);
IPToStr(ip_str2, sizeof(ip_str2), dest_ip);
ToStr(mark_str1, mark);
Format(mark_str2, sizeof(mark_str2), "%x", mark);
for (i = 0;i < LIST_NUM(s->EntryList);i++)
{
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
if (StrCmpi(e->Chain, chain) == 0)
{
if (InStr(e->ConditionAndArgs, ip_str1) &&
InStr(e->ConditionAndArgs, ip_str2) &&
(InStr(e->ConditionAndArgs, mark_str1) || InStr(e->ConditionAndArgs, mark_str2)))
{
return e;
}
}
}
return NULL;
}
示例13: LockList
// Get reverse listener socket in Cedar
SOCK *GetReverseListeningSock(CEDAR *c)
{
SOCK *s = NULL;
// Validate arguments
if (c == NULL)
{
return NULL;
}
LockList(c->ListenerList);
{
UINT i;
for (i = 0;i < LIST_NUM(c->ListenerList);i++)
{
LISTENER *r = LIST_DATA(c->ListenerList, i);
if (r->Protocol == LISTENER_REVERSE)
{
Lock(r->lock);
{
s = r->Sock;
AddRef(s->ref);
}
Unlock(r->lock);
break;
}
}
}
UnlockList(c->ListenerList);
return s;
}
示例14: DelUDPEntry
// Delete the UDP session from the UDP entry
void DelUDPEntry(CEDAR *cedar, SESSION *session)
{
UINT num, i;
// Validate arguments
if (cedar == NULL || session == NULL)
{
return;
}
LockList(cedar->UDPEntryList);
{
num = LIST_NUM(cedar->UDPEntryList);
for (i = 0;i < num;i++)
{
UDP_ENTRY *e = LIST_DATA(cedar->UDPEntryList, i);
if (e->Session == session)
{
ReleaseSession(e->Session);
Delete(cedar->UDPEntryList, e);
Free(e);
UnlockList(cedar->UDPEntryList);
Debug("UDP_Entry Deleted.\n");
return;
}
}
}
UnlockList(cedar->UDPEntryList);
}
示例15: LIST_DATA
// Get the best routing table entry for the specified IP address
L3TABLE *L3GetBestRoute(L3SW *s, UINT ip)
{
UINT i;
UINT max_mask = 0;
UINT min_metric = INFINITE;
L3TABLE *ret = NULL;
// Validate arguments
if (s == NULL || ip == 0)
{
return NULL;
}
// 1st condition: Choose the one which have the largest subnet mask
// 2nd condition: Choose the one which have the smallest metric
for (i = 0;i < LIST_NUM(s->TableList);i++)
{
L3TABLE *t = LIST_DATA(s->TableList, i);
if ((t->NetworkAddress & t->SubnetMask) == (ip & t->SubnetMask))
{
if (t->SubnetMask >= max_mask)
{
max_mask = t->SubnetMask;
if (min_metric >= t->Metric)
{
min_metric = t->Metric;
ret = t;
}
}
}
}
return ret;
}