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
baaed37d
Commit
baaed37d
authored
Jan 22, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmpapi: Implement SnmpUtilOid{Append, Cmp, NCmp}. Fix SnmpUtilOid{Cpy, Free}.
parent
bca85b3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
12 deletions
+77
-12
main.c
dlls/snmpapi/main.c
+74
-9
snmpapi.spec
dlls/snmpapi/snmpapi.spec
+3
-3
No files found.
dlls/snmpapi/main.c
View file @
baaed37d
...
...
@@ -253,23 +253,53 @@ INT WINAPI SnmpUtilOctetsCmp(AsnOctetString *octets1, AsnOctetString *octets2)
}
/***********************************************************************
* SnmpUtilOid
Cpy
(SNMPAPI.@)
* SnmpUtilOid
Append
(SNMPAPI.@)
*/
INT
WINAPI
SnmpUtilOid
Cpy
(
AsnObjectIdentifier
*
dst
,
AsnObjectIdentifier
*
src
)
INT
WINAPI
SnmpUtilOid
Append
(
AsnObjectIdentifier
*
dst
,
AsnObjectIdentifier
*
src
)
{
unsigned
int
i
,
size
;
UINT
*
ids
,
i
,
size
;
TRACE
(
"(%p, %p)
\n
"
,
dst
,
src
);
size
=
sizeof
(
AsnObjectIdentifier
);
if
((
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
if
(
!
dst
)
return
SNMPAPI_ERROR
;
if
(
!
src
)
return
SNMPAPI_NOERROR
;
size
=
(
src
->
idLength
+
dst
->
idLength
)
*
sizeof
(
UINT
);
if
(
!
(
ids
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dst
->
ids
,
size
)))
{
size
=
src
->
idLength
*
sizeof
(
UINT
);
if
(
!
(
dst
->
ids
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
if
(
!
(
ids
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
dst
);
SetLastError
(
SNMP_MEM_ALLOC_ERROR
);
return
SNMPAPI_ERROR
;
}
else
memcpy
(
ids
,
dst
->
ids
,
dst
->
idLength
*
sizeof
(
UINT
));
}
for
(
i
=
0
;
i
<
src
->
idLength
;
i
++
)
ids
[
i
+
dst
->
idLength
]
=
src
->
ids
[
i
];
dst
->
idLength
=
dst
->
idLength
+
src
->
idLength
;
dst
->
ids
=
ids
;
return
SNMPAPI_NOERROR
;
}
/***********************************************************************
* SnmpUtilOidCpy (SNMPAPI.@)
*/
INT
WINAPI
SnmpUtilOidCpy
(
AsnObjectIdentifier
*
dst
,
AsnObjectIdentifier
*
src
)
{
TRACE
(
"(%p, %p)
\n
"
,
dst
,
src
);
if
(
!
dst
)
return
SNMPAPI_ERROR
;
if
(
!
src
)
{
dst
->
idLength
=
0
;
dst
->
ids
=
NULL
;
return
SNMPAPI_NOERROR
;
}
if
((
dst
->
ids
=
HeapAlloc
(
GetProcessHeap
(),
0
,
src
->
idLength
*
sizeof
(
UINT
))))
{
unsigned
int
i
;
dst
->
idLength
=
src
->
idLength
;
for
(
i
=
0
;
i
<
dst
->
idLength
;
i
++
)
dst
->
ids
[
i
]
=
src
->
ids
[
i
];
return
SNMPAPI_NOERROR
;
...
...
@@ -284,8 +314,43 @@ void WINAPI SnmpUtilOidFree(AsnObjectIdentifier *oid)
{
TRACE
(
"(%p)
\n
"
,
oid
);
if
(
!
oid
)
return
;
oid
->
idLength
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
oid
->
ids
);
HeapFree
(
GetProcessHeap
(),
0
,
oid
);
oid
->
ids
=
NULL
;
}
/***********************************************************************
* SnmpUtilOidNCmp (SNMPAPI.@)
*/
INT
WINAPI
SnmpUtilOidNCmp
(
AsnObjectIdentifier
*
oid1
,
AsnObjectIdentifier
*
oid2
,
UINT
count
)
{
unsigned
int
i
;
TRACE
(
"(%p, %p, %d)
\n
"
,
oid1
,
oid2
,
count
);
if
(
!
oid1
||
!
oid2
)
return
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
oid1
->
ids
[
i
]
>
oid2
->
ids
[
i
])
return
1
;
if
(
oid1
->
ids
[
i
]
<
oid2
->
ids
[
i
])
return
-
1
;
}
return
0
;
}
/***********************************************************************
* SnmpUtilOidCmp (SNMPAPI.@)
*/
INT
WINAPI
SnmpUtilOidCmp
(
AsnObjectIdentifier
*
oid1
,
AsnObjectIdentifier
*
oid2
)
{
TRACE
(
"(%p, %p)
\n
"
,
oid1
,
oid2
);
if
(
oid1
->
idLength
<
oid2
->
idLength
)
return
-
1
;
if
(
oid1
->
idLength
>
oid2
->
idLength
)
return
1
;
return
SnmpUtilOidNCmp
(
oid1
,
oid2
,
oid1
->
idLength
);
}
/***********************************************************************
...
...
dlls/snmpapi/snmpapi.spec
View file @
baaed37d
...
...
@@ -29,11 +29,11 @@
@ stdcall SnmpUtilOctetsCpy(ptr ptr)
@ stdcall SnmpUtilOctetsFree(ptr)
@ stdcall SnmpUtilOctetsNCmp(ptr ptr long)
@ st
ub SnmpUtilOidAppend
@ st
ub SnmpUtilOidCmp
@ st
dcall SnmpUtilOidAppend(ptr ptr)
@ st
dcall SnmpUtilOidCmp(ptr ptr)
@ stdcall SnmpUtilOidCpy(ptr ptr)
@ stdcall SnmpUtilOidFree(ptr)
@ st
ub SnmpUtilOidNCmp
@ st
dcall SnmpUtilOidNCmp(ptr ptr long)
@ stub SnmpUtilOidToA
@ stub SnmpUtilPrintAsnAny
@ stub SnmpUtilPrintOid
...
...
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