Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cf3d35cf
Commit
cf3d35cf
authored
Jun 28, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Jun 30, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inetmib1: Make table searching function into a generic helper.
parent
3e57f56f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
main.c
dlls/inetmib1/main.c
+18
-18
No files found.
dlls/inetmib1/main.c
View file @
cf3d35cf
...
@@ -352,18 +352,18 @@ static UINT findValueInTable(AsnObjectIdentifier *oid,
...
@@ -352,18 +352,18 @@ static UINT findValueInTable(AsnObjectIdentifier *oid,
}
}
/* Given an OID and a base OID that it must begin with, finds the item and
/* Given an OID and a base OID that it must begin with, finds the item and
* element of the table whose
IP address
matches the instance from the OID.
* element of the table whose
value
matches the instance from the OID.
*
E.g., given an OID foo.1.2.3.4.5 and a base OID foo, returns item 1 and the
*
The OID is converted to a key with the function makeKey, and compared
*
index of the entry in the table whose IP address is 2.3.4.5
.
*
against entries in the table with the function compare
.
* If bPduType is not SNMP_PDU_GETNEXT and either the item or instance is
* If bPduType is not SNMP_PDU_GETNEXT and either the item or instance is
* missing, returns SNMP_ERRORSTATUS_NOSUCHNAME.
* missing, returns SNMP_ERRORSTATUS_NOSUCHNAME.
* If bPduType is SNMP_PDU_GETNEXT, returns the successor to the item and
* If bPduType is SNMP_PDU_GETNEXT, returns the successor to the item and
* instance, or item 1, instance 1 if either is missing.
* instance, or item 1, instance 1 if either is missing.
*/
*/
static
AsnInteger32
getItemAndI
pAddressInstanceFromOid
(
AsnObjectIdentifier
*
oid
,
static
AsnInteger32
getItemAndI
nstanceFromTable
(
AsnObjectIdentifier
*
oid
,
AsnObjectIdentifier
*
base
,
BYTE
bPduType
,
struct
GenericTable
*
tabl
e
,
AsnObjectIdentifier
*
base
,
UINT
instanceLen
,
BYTE
bPduTyp
e
,
s
ize_t
tableEntrySize
,
oidToKeyFunc
makeKey
,
compareFunc
compare
,
s
truct
GenericTable
*
table
,
size_t
tableEntrySize
,
oidToKeyFunc
makeKey
,
UINT
*
item
,
UINT
*
instance
)
compareFunc
compare
,
UINT
*
item
,
UINT
*
instance
)
{
{
AsnInteger32
ret
=
SNMP_ERRORSTATUS_NOERROR
;
AsnInteger32
ret
=
SNMP_ERRORSTATUS_NOERROR
;
...
@@ -380,7 +380,7 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
...
@@ -380,7 +380,7 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
*
instance
=
1
;
*
instance
=
1
;
}
}
else
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
else
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
oid
->
idLength
<
base
->
idLength
+
5
)
oid
->
idLength
<
base
->
idLength
+
instanceLen
+
1
)
{
{
/* Either the table or an item is specified, but the instance is
/* Either the table or an item is specified, but the instance is
* not.
* not.
...
@@ -396,7 +396,7 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
...
@@ -396,7 +396,7 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
*
item
=
1
;
*
item
=
1
;
}
}
else
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
else
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
oid
->
idLength
==
base
->
idLength
+
5
)
oid
->
idLength
==
base
->
idLength
+
instanceLen
+
1
)
{
{
*
item
=
oid
->
ids
[
base
->
idLength
];
*
item
=
oid
->
ids
[
base
->
idLength
];
if
(
!*
item
)
if
(
!*
item
)
...
@@ -406,8 +406,8 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
...
@@ -406,8 +406,8 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
}
}
else
else
{
{
AsnObjectIdentifier
ipOid
=
{
4
,
oid
->
ids
+
base
->
idLength
+
1
AsnObjectIdentifier
ipOid
=
{
instanceLen
,
};
oid
->
ids
+
base
->
idLength
+
1
};
*
instance
=
findValueInTable
(
&
ipOid
,
table
,
tableEntrySize
,
*
instance
=
findValueInTable
(
&
ipOid
,
table
,
tableEntrySize
,
makeKey
,
compare
)
+
1
;
makeKey
,
compare
)
+
1
;
...
@@ -420,15 +420,15 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
...
@@ -420,15 +420,15 @@ static AsnInteger32 getItemAndIpAddressInstanceFromOid(AsnObjectIdentifier *oid,
break
;
break
;
default:
default:
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
if
(
!
SnmpUtilOidNCmp
(
oid
,
base
,
base
->
idLength
)
&&
oid
->
idLength
==
base
->
idLength
+
5
)
oid
->
idLength
==
base
->
idLength
+
instanceLen
+
1
)
{
{
*
item
=
oid
->
ids
[
base
->
idLength
];
*
item
=
oid
->
ids
[
base
->
idLength
];
if
(
!*
item
)
if
(
!*
item
)
ret
=
SNMP_ERRORSTATUS_NOSUCHNAME
;
ret
=
SNMP_ERRORSTATUS_NOSUCHNAME
;
else
else
{
{
AsnObjectIdentifier
ipOid
=
{
4
,
oid
->
ids
+
base
->
idLength
+
1
AsnObjectIdentifier
ipOid
=
{
instanceLen
,
};
oid
->
ids
+
base
->
idLength
+
1
};
*
instance
=
findValueInTable
(
&
ipOid
,
table
,
tableEntrySize
,
*
instance
=
findValueInTable
(
&
ipOid
,
table
,
tableEntrySize
,
makeKey
,
compare
);
makeKey
,
compare
);
...
@@ -680,8 +680,8 @@ static BOOL mib2IpAddrQuery(BYTE bPduType, SnmpVarBind *pVarBind,
...
@@ -680,8 +680,8 @@ static BOOL mib2IpAddrQuery(BYTE bPduType, SnmpVarBind *pVarBind,
{
{
case
SNMP_PDU_GET
:
case
SNMP_PDU_GET
:
case
SNMP_PDU_GETNEXT
:
case
SNMP_PDU_GETNEXT
:
*
pErrorStatus
=
getItemAndI
pAddressInstanceFromOid
(
&
pVarBind
->
name
,
*
pErrorStatus
=
getItemAndI
nstanceFromTable
(
&
pVarBind
->
name
,
&
myOid
,
bPduType
,
(
struct
GenericTable
*
)
ipAddrTable
,
&
myOid
,
4
,
bPduType
,
(
struct
GenericTable
*
)
ipAddrTable
,
sizeof
(
MIB_IPADDRROW
),
oidToIpAddrRow
,
compareIpAddrRow
,
&
item
,
sizeof
(
MIB_IPADDRROW
),
oidToIpAddrRow
,
compareIpAddrRow
,
&
item
,
&
tableIndex
);
&
tableIndex
);
if
(
!*
pErrorStatus
)
if
(
!*
pErrorStatus
)
...
@@ -763,8 +763,8 @@ static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind,
...
@@ -763,8 +763,8 @@ static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind,
{
{
case
SNMP_PDU_GET
:
case
SNMP_PDU_GET
:
case
SNMP_PDU_GETNEXT
:
case
SNMP_PDU_GETNEXT
:
*
pErrorStatus
=
getItemAndI
pAddressInstanceFromOid
(
&
pVarBind
->
name
,
*
pErrorStatus
=
getItemAndI
nstanceFromTable
(
&
pVarBind
->
name
,
&
myOid
,
bPduType
,
(
struct
GenericTable
*
)
ipRouteTable
,
&
myOid
,
4
,
bPduType
,
(
struct
GenericTable
*
)
ipRouteTable
,
sizeof
(
MIB_IPFORWARDROW
),
oidToIpForwardRow
,
compareIpForwardRow
,
sizeof
(
MIB_IPFORWARDROW
),
oidToIpForwardRow
,
compareIpForwardRow
,
&
item
,
&
tableIndex
);
&
item
,
&
tableIndex
);
if
(
!*
pErrorStatus
)
if
(
!*
pErrorStatus
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment