× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,

after some fiddling, I have new insights and the central question is way more easy.


Am 28.12.2021 um 00:11 schrieb Patrik Schindler <poc@xxxxxxxxxx>:

typedef struct {
unsigned char pdu_type;
int error_status;
int error_index;
varBind * varbind;
} snmppdu;

typedef struct _varBind{
struct _varBind * next;
char *oid; /* NULL terminated */
unsigned char asn_type;
int val_len;
union {
int * int_val;
char * str_val;
} val;
};

typedef struct _varBind varBind;

When I run the program with different OIDs, pdu->varbind->val_len apparently has the correct size for the returned data. The remaining question is: How to correctly access the data in that union?

Code:

Qp0zLprintf("Result has %d bytes and is: %s\n", pdu->varbind->val_len, pdu->varbind->val.str_val);

This is the only variant of dots and -> which does compile without error.

Thanks!

(I deliberately leave out the conversion from EBCDIC to ASCII for the sake of simplifying my question.)

:wq! PoC


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2023 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.