Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Herman Semenov
wine
Commits
d3e51291
Commit
d3e51291
authored
18 years ago
by
Hans Leidekker
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
snmpapi: Implement SnmpUtil{DbgPrint, IdsToA, OidToA, PrintAsnAny, PrintOid}.
parent
f79ffe47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/snmpapi/main.c
+166
-0
166 additions, 0 deletions
dlls/snmpapi/main.c
dlls/snmpapi/snmpapi.spec
+5
-5
5 additions, 5 deletions
dlls/snmpapi/snmpapi.spec
with
171 additions
and
5 deletions
dlls/snmpapi/main.c
+
166
−
0
View file @
d3e51291
...
...
@@ -21,6 +21,7 @@
#include
"config.h"
#include
<stdio.h>
#include
<stdarg.h>
#include
"windef.h"
...
...
@@ -133,6 +134,14 @@ BOOL WINAPI DllMain(
return
TRUE
;
}
/***********************************************************************
* SnmpUtilDbgPrint (SNMPAPI.@)
*/
void
WINAPI
SnmpUtilDbgPrint
(
INT
loglevel
,
LPSTR
format
,
...)
{
FIXME
(
"(%d, %s)
\n
"
,
loglevel
,
debugstr_a
(
format
));
}
/***********************************************************************
* SnmpUtilMemAlloc (SNMPAPI.@)
*/
...
...
@@ -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
;
}
}
}
This diff is collapsed.
Click to expand it.
dlls/snmpapi/snmpapi.spec
+
5
−
5
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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment