Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f913252e
Commit
f913252e
authored
May 20, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Jun 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inetmib1: Support querying the MIB2 number of interfaces.
parent
dedff132
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
main.c
dlls/inetmib1/main.c
+52
-1
main.c
dlls/inetmib1/tests/main.c
+0
-2
No files found.
dlls/inetmib1/main.c
View file @
f913252e
...
...
@@ -48,6 +48,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return
TRUE
;
}
/**
* Utility functions
*/
static
void
copyInt
(
AsnAny
*
value
,
void
*
src
)
{
value
->
asnType
=
ASN_INTEGER
;
value
->
asnValue
.
number
=
*
(
DWORD
*
)
src
;
}
static
UINT
mib2
[]
=
{
1
,
3
,
6
,
1
,
2
,
1
};
static
UINT
mib2System
[]
=
{
1
,
3
,
6
,
1
,
2
,
1
,
1
};
...
...
@@ -76,9 +85,51 @@ static void mib2IfNumberInit(void)
}
}
static
BOOL
mib2IfNumberQuery
(
BYTE
bPduType
,
SnmpVarBind
*
pVarBind
,
AsnInteger32
*
pErrorStatus
)
{
AsnObjectIdentifier
numberOid
=
DEFINE_OID
(
mib2IfNumber
);
TRACE
(
"(0x%02x, %s, %p)
\n
"
,
bPduType
,
SnmpUtilOidToA
(
&
pVarBind
->
name
),
pErrorStatus
);
switch
(
bPduType
)
{
case
SNMP_PDU_GET
:
case
SNMP_PDU_GETNEXT
:
if
((
bPduType
==
SNMP_PDU_GET
&&
!
SnmpUtilOidNCmp
(
&
pVarBind
->
name
,
&
numberOid
,
numberOid
.
idLength
))
||
SnmpUtilOidNCmp
(
&
pVarBind
->
name
,
&
numberOid
,
numberOid
.
idLength
)
<
0
)
{
DWORD
numIfs
=
ifTable
?
ifTable
->
dwNumEntries
:
0
;
copyInt
(
&
pVarBind
->
value
,
&
numIfs
);
if
(
bPduType
==
SNMP_PDU_GETNEXT
)
SnmpUtilOidCpy
(
&
pVarBind
->
name
,
&
numberOid
);
*
pErrorStatus
=
SNMP_ERRORSTATUS_NOERROR
;
}
else
{
*
pErrorStatus
=
SNMP_ERRORSTATUS_NOSUCHNAME
;
/* Caller deals with OID if bPduType == SNMP_PDU_GETNEXT, so don't
* need to set it here.
*/
}
break
;
case
SNMP_PDU_SET
:
*
pErrorStatus
=
SNMP_ERRORSTATUS_READONLY
;
break
;
default:
FIXME
(
"0x%02x: unsupported PDU type
\n
"
,
bPduType
);
*
pErrorStatus
=
SNMP_ERRORSTATUS_NOSUCHNAME
;
}
return
TRUE
;
}
/* This list MUST BE lexicographically sorted */
static
struct
mibImplementation
supportedIDs
[]
=
{
{
DEFINE_OID
(
mib2IfNumber
),
mib2IfNumberInit
},
{
DEFINE_OID
(
mib2IfNumber
),
mib2IfNumberInit
,
mib2IfNumberQuery
},
};
static
UINT
minSupportedIDLength
;
...
...
dlls/inetmib1/tests/main.c
View file @
f913252e
...
...
@@ -132,11 +132,9 @@ static void testQuery(void)
moreData
=
TRUE
;
ret
=
pQuery
(
SNMP_PDU_GETNEXT
,
&
list
,
&
error
,
&
index
);
ok
(
ret
,
"SnmpExtensionQuery failed: %d
\n
"
,
GetLastError
());
todo_wine
{
ok
(
error
==
SNMP_ERRORSTATUS_NOERROR
,
"expected SNMP_ERRORSTATUS_NOERROR, got %d
\n
"
,
error
);
ok
(
index
==
0
,
"expected index 0, got %d
\n
"
,
index
);
}
vars
[
0
].
name
.
idLength
=
sizeof
(
mib2If
)
/
sizeof
(
mib2If
[
0
]);
vars
[
0
].
name
.
ids
=
mib2If
;
ok
(
!
SnmpUtilOidNCmp
(
&
vars2
[
0
].
name
,
&
vars
[
0
].
name
,
vars
[
0
].
name
.
idLength
),
...
...
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