|
Hi,
I'm trying to get an snmp apis converted to RPG, but there's far too many
pointers involved for my liking...
This is the C api (from unix api manual):
int snmpGet(snmppdu * pdu_ptr,
char * host_ptr,
unsigned long int time_out,
char * comm_ptr,
unsigned long int comm_len);
and the pdu_ptr struct is:
struct _varBind{ struct _varBind * next;
char *oid; /* Null Terminated */
unsigned char asn_type;
int val_len;
union { int * int_val; char * str_val; } val; };
I've been thrown by the fact the api returns a pointer to a DS with
pointers...
0002.00 D getsnmp PR 10I 0 ExtProc('snmpGet')
0003.00 D pdu_ptr * value options(*string)
0004.00 D host_ptr * value options(*string)
0005.00 D timeout 10U 0 value
0006.00 D comm_ptr * value
0007.00 D comm_len 10U 0 value
0008.00
0009.00 D pdu_ptr_s S *
0010.00 D pdu_ds DS based(pdu_ptr_s)
0011.00 D next *
0012.00 D oid *
0013.00 D asn_type *
0014.00 D val_len 10I 0
0015.00 D result *
0036.00 c eval x = getsnmp(pdu_ptr_s:
0037.00 c %addr(hostname):
0038.00 c 5:
0039.00 c %addr(commname):
0040.00 c 6)
So if I do this and snmpget returns OK, the 'result' field (from the DS) is
*NULL but in debug an 'eval pdu_ds' shows 'result' is a valid pointer...
So my 2 questions are:
1) Is the api translated to rpg ok
2) can i access %str(result) or should I be doing something else.
It's really an rpg question but I know you guys understand both...
thanks,
Brendan
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.