Commit f1fc35de authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

snmpapi: Implement SnmpUtilOidCpy, SnmpUtilOidFree and SnmpUtilVarBindFree.

parent d62b5c6c
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "snmp.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(snmpapi); WINE_DEFAULT_DEBUG_CHANNEL(snmpapi);
...@@ -50,3 +52,61 @@ BOOL WINAPI DllMain( ...@@ -50,3 +52,61 @@ BOOL WINAPI DllMain(
return TRUE; return TRUE;
} }
INT WINAPI SnmpUtilOidCpy(AsnObjectIdentifier *dst, AsnObjectIdentifier *src)
{
unsigned int i, size;
TRACE("(%p, %p)\n", dst, src);
size = sizeof(AsnObjectIdentifier);
if ((dst = HeapAlloc(GetProcessHeap(), 0, size)))
{
size = src->idLength * sizeof(UINT);
if (!(dst->ids = HeapAlloc(GetProcessHeap(), 0, size)))
{
HeapFree(GetProcessHeap(), 0, dst);
return SNMPAPI_ERROR;
}
dst->idLength = src->idLength;
for (i = 0; i < dst->idLength; i++) dst->ids[i] = src->ids[i];
return SNMPAPI_NOERROR;
}
return SNMPAPI_ERROR;
}
void WINAPI SnmpUtilOidFree(AsnObjectIdentifier *oid)
{
TRACE("(%p)\n", oid);
HeapFree(GetProcessHeap(), 0, oid->ids);
HeapFree(GetProcessHeap(), 0, oid);
}
void WINAPI SnmpUtilVarBindFree(SnmpVarBind *vb)
{
TRACE("(%p)\n", vb);
switch (vb->value.asnType)
{
case ASN_OCTETSTRING:
case ASN_BITS:
case ASN_SEQUENCE:
case ASN_IPADDRESS:
case ASN_OPAQUE:
{
if (vb->value.asnValue.string.dynamic)
HeapFree(GetProcessHeap(), 0, vb->value.asnValue.string.stream);
break;
}
case ASN_OBJECTIDENTIFIER:
{
HeapFree(GetProcessHeap(), 0, vb->value.asnValue.object.ids);
break;
}
default: break;
}
HeapFree(GetProcessHeap(), 0, vb->name.ids);
HeapFree(GetProcessHeap(), 0, vb);
}
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
@ stub SnmpUtilMemReAlloc @ stub SnmpUtilMemReAlloc
@ stub SnmpUtilOidAppend @ stub SnmpUtilOidAppend
@ stub SnmpUtilOidCmp @ stub SnmpUtilOidCmp
@ stub SnmpUtilOidCpy @ stdcall SnmpUtilOidCpy(ptr ptr)
@ stub SnmpUtilOidFree @ stdcall SnmpUtilOidFree(ptr)
@ stub SnmpUtilOidNCmp @ stub SnmpUtilOidNCmp
@ stub SnmpUtilOidToA @ stub SnmpUtilOidToA
@ stub SnmpUtilPrintAsnAny @ stub SnmpUtilPrintAsnAny
...@@ -34,6 +34,6 @@ ...@@ -34,6 +34,6 @@
@ stub SnmpUtilStrlenW @ stub SnmpUtilStrlenW
@ stub SnmpUtilUnicodeToAnsi @ stub SnmpUtilUnicodeToAnsi
@ stub SnmpUtilVarBindCpy @ stub SnmpUtilVarBindCpy
@ stub SnmpUtilVarBindFree @ stdcall SnmpUtilVarBindFree(ptr)
@ stub SnmpUtilVarBindListCpy @ stub SnmpUtilVarBindListCpy
@ stub SnmpUtilVarBindListFree @ stub SnmpUtilVarBindListFree
...@@ -201,6 +201,9 @@ typedef struct { ...@@ -201,6 +201,9 @@ typedef struct {
#define SNMP_AUTHAPI_INVALID_MSG_TYPE 31 #define SNMP_AUTHAPI_INVALID_MSG_TYPE 31
#define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32 #define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32
#define SNMPAPI_NOERROR TRUE
#define SNMPAPI_ERROR FALSE
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment