How to decode addresses when receiving traps (version 5.4.1).

Alain GUENRO <[email protected]>
Newsgroups gmane.network.net-snmp.user
Organization Kabira
Message-ID <[email protected]>
Hello list,

I am porting a trap handler code from net-snmp-4.2.7 to net-snmp-5.4.1 
on Solaris and linux platforms

To extract addresses (with net-snmp-4.2.7), there was the following code:

char agentAddr[50];
char senderAddr[50];

struct sockaddr_in *agentIp = (struct sockaddr_in *)&pdu->agent_addr;
struct sockaddr_in *pduIp = (struct sockaddr_in *)&pdu->address;

strncpy(agentAddr, inet_ntoa(agentIp->sin_addr), 50);
strncpy(senderAddr, inet_ntoa(pduIp->sin_addr), 50);

----------
With net-snmp-5.4.1, the stuct snmp_dpu fields were modified:
- "snmp_ipaddr address;" was replaced by "void * transport_data;"
- "snmp_ipaddr agent_addr;" was replaced by "unsigned char agent_addr[4];"

Which code can be use to extract addresses (with net-snmp-5.4.1) from 
these fields ?


Regards,

Alain GUENRO

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.