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
d3e51291
Commit
d3e51291
authored
Jan 22, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmpapi: Implement SnmpUtil{DbgPrint, IdsToA, OidToA, PrintAsnAny, PrintOid}.
parent
f79ffe47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
171 additions
and
5 deletions
+171
-5
main.c
dlls/snmpapi/main.c
+166
-0
snmpapi.spec
dlls/snmpapi/snmpapi.spec
+5
-5
No files found.
dlls/snmpapi/main.c
View file @
d3e51291
...
...
@@ -21,6 +21,7 @@
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
...
...
@@ -134,6 +135,14 @@ BOOL WINAPI DllMain(
}
/***********************************************************************
* SnmpUtilDbgPrint (SNMPAPI.@)
*/
void
WINAPI
SnmpUtilDbgPrint
(
INT
loglevel
,
LPSTR
format
,
...)
{
FIXME
(
"(%d, %s)
\n
"
,
loglevel
,
debugstr_a
(
format
));
}
/***********************************************************************
* SnmpUtilMemAlloc (SNMPAPI.@)
*/
LPVOID
WINAPI
SnmpUtilMemAlloc
(
UINT
nbytes
)
...
...
@@ -448,3 +457,160 @@ void WINAPI SnmpUtilVarBindListFree(SnmpVarBindList *vb)
for
(
i
=
0
;
i
<
vb
->
len
;
i
++
)
SnmpUtilVarBindFree
(
entry
++
);
HeapFree
(
GetProcessHeap
(),
0
,
vb
->
list
);
}
/***********************************************************************
* SnmpUtilIdsToA (SNMPAPI.@)
*/
LPSTR
WINAPI
SnmpUtilIdsToA
(
UINT
*
ids
,
UINT
length
)
{
static
char
one
[
10
],
oid
[
514
],
null_oid
[]
=
"<null oid>"
;
unsigned
int
i
,
len
,
left
=
sizeof
(
oid
)
-
1
;
TRACE
(
"(%p, %d)
\n
"
,
ids
,
length
);
if
(
!
ids
||
!
length
)
return
null_oid
;
*
oid
=
0
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
sprintf
(
one
,
"%d"
,
ids
[
i
]);
len
=
strlen
(
one
);
if
(
left
>=
len
)
{
strcat
(
oid
,
one
);
left
-=
len
;
}
else
return
oid
;
if
(
i
<
length
-
1
)
{
if
(
left
>
0
)
{
strcat
(
oid
,
"."
);
left
--
;
}
else
return
oid
;
}
}
return
oid
;
}
/***********************************************************************
* SnmpUtilOidToA (SNMPAPI.@)
*/
LPSTR
WINAPI
SnmpUtilOidToA
(
AsnObjectIdentifier
*
oid
)
{
static
char
null_oid
[]
=
"<null oid>"
;
TRACE
(
"(%p)
\n
"
,
oid
);
if
(
oid
)
return
SnmpUtilIdsToA
(
oid
->
ids
,
oid
->
idLength
);
else
return
null_oid
;
}
/***********************************************************************
* SnmpUtilPrintOid (SNMPAPI.@)
*/
void
WINAPI
SnmpUtilPrintOid
(
AsnObjectIdentifier
*
oid
)
{
unsigned
int
i
;
TRACE
(
"(%p)
\n
"
,
oid
);
if
(
!
oid
)
return
;
for
(
i
=
0
;
i
<
oid
->
idLength
;
i
++
)
{
TRACE
(
"%u"
,
oid
->
ids
[
i
]);
if
(
i
<
oid
->
idLength
-
1
)
TRACE
(
"."
);
}
}
/***********************************************************************
* SnmpUtilPrintAsnAny (SNMPAPI.@)
*/
void
WINAPI
SnmpUtilPrintAsnAny
(
AsnAny
*
any
)
{
unsigned
int
i
;
TRACE
(
"(%p)
\n
"
,
any
);
switch
(
any
->
asnType
)
{
case
ASN_NULL
:
TRACE
(
"Null value
\n
"
);
return
;
case
ASN_INTEGER32
:
TRACE
(
"Integer32 %d
\n
"
,
any
->
asnValue
.
number
);
return
;
case
ASN_UNSIGNED32
:
TRACE
(
"Unsigned32 %u
\n
"
,
any
->
asnValue
.
unsigned32
);
return
;
case
ASN_COUNTER32
:
TRACE
(
"Counter32 %u
\n
"
,
any
->
asnValue
.
counter
);
return
;
case
ASN_GAUGE32
:
TRACE
(
"Gauge32 %u
\n
"
,
any
->
asnValue
.
gauge
);
return
;
case
ASN_TIMETICKS
:
TRACE
(
"Timeticks %u
\n
"
,
any
->
asnValue
.
ticks
);
return
;
case
ASN_COUNTER64
:
{
TRACE
(
"Counter64 %llu
\n
"
,
any
->
asnValue
.
counter64
.
QuadPart
);
return
;
}
case
ASN_OCTETSTRING
:
{
TRACE
(
"String "
);
for
(
i
=
0
;
i
<
any
->
asnValue
.
string
.
length
;
i
++
)
TRACE
(
"%c"
,
any
->
asnValue
.
string
.
stream
[
i
]);
TRACE
(
"
\n
"
);
return
;
}
case
ASN_IPADDRESS
:
{
TRACE
(
"IpAddress "
);
if
(
any
->
asnValue
.
string
.
length
<
4
)
{
TRACE
(
"Invalid
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
4
;
i
++
)
{
TRACE
(
"%u"
,
any
->
asnValue
.
string
.
stream
[
i
]);
if
(
i
<
3
)
TRACE
(
"."
);
}
TRACE
(
"
\n
"
);
return
;
}
case
ASN_BITS
:
{
TRACE
(
"Bits "
);
for
(
i
=
0
;
i
<
any
->
asnValue
.
string
.
length
;
i
++
)
{
TRACE
(
"0x%02x"
,
any
->
asnValue
.
string
.
stream
[
i
]);
if
(
i
<
any
->
asnValue
.
object
.
idLength
-
1
)
TRACE
(
" "
);
}
TRACE
(
"
\n
"
);
return
;
}
case
ASN_OPAQUE
:
{
TRACE
(
"Opaque "
);
for
(
i
=
0
;
i
<
any
->
asnValue
.
string
.
length
;
i
++
)
{
TRACE
(
"0x%02x"
,
any
->
asnValue
.
string
.
stream
[
i
]);
if
(
i
<
any
->
asnValue
.
object
.
idLength
-
1
)
TRACE
(
" "
);
}
TRACE
(
"
\n
"
);
return
;
}
case
ASN_OBJECTIDENTIFIER
:
{
TRACE
(
"ObjectID "
);
for
(
i
=
0
;
i
<
any
->
asnValue
.
object
.
idLength
;
i
++
)
{
TRACE
(
"%u"
,
any
->
asnValue
.
object
.
ids
[
i
]);
if
(
i
<
any
->
asnValue
.
object
.
idLength
-
1
)
TRACE
(
"."
);
}
TRACE
(
"
\n
"
);
return
;
}
default:
{
TRACE
(
"Invalid type %d
\n
"
,
any
->
asnType
);
return
;
}
}
}
dlls/snmpapi/snmpapi.spec
View file @
d3e51291
...
...
@@ -20,8 +20,8 @@
@ stub SnmpUtilAnsiToUnicode
@ stdcall SnmpUtilAsnAnyCpy(ptr ptr)
@ stdcall SnmpUtilAsnAnyFree(ptr)
@ st
ub SnmpUtilDbgPrint
@ st
ub SnmpUtilIdsToA
@ st
dcall SnmpUtilDbgPrint(long str)
@ st
dcall SnmpUtilIdsToA(ptr long)
@ stdcall SnmpUtilMemAlloc(long)
@ stdcall SnmpUtilMemFree(ptr)
@ stdcall SnmpUtilMemReAlloc(ptr long)
...
...
@@ -34,9 +34,9 @@
@ stdcall SnmpUtilOidCpy(ptr ptr)
@ stdcall SnmpUtilOidFree(ptr)
@ stdcall SnmpUtilOidNCmp(ptr ptr long)
@ st
ub SnmpUtilOidToA
@ st
ub SnmpUtilPrintAsnAny
@ st
ub SnmpUtilPrintOid
@ st
dcall SnmpUtilOidToA(ptr)
@ st
dcall SnmpUtilPrintAsnAny(ptr)
@ st
dcall SnmpUtilPrintOid(ptr)
@ stub SnmpUtilStrlenW
@ stub SnmpUtilUnicodeToAnsi
@ stdcall SnmpUtilVarBindCpy(ptr ptr)
...
...
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