--===============1261770687==
Content-Type: multipart/alternative;
boundary="----=_Part_171364_6882790.1179067770401"

------=_Part_171364_6882790.1179067770401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Aluisio Leonelo Victal,
> I belive that you want de source address of ip packets, but i need more
>information about the "struct pdu" and any another information about how
>you catch the packets.


I used net-snmp-5.3.0.1, I also used
snmptrapd_add_session(netsnmp_transport *transport) to get the packet, and
in the function callback function --- snmp_input is used to process an
incoming trap through calling a new
function------trap_message_handler(netsnmp_pdu *, netsnmp_trapsport *,
netsnmp_trapd_handler *) which I add. The pdu is a struct netsnmp_pdu, and
unsigned char agent_addr[4] is the a item of the struct, I get the ip
through agent_addr as follow:

char *strIpAddress;
struct in_addr sInAddr = *(struct in_addr *)pdu->agent_addr;
strIpAddress = inet_ntoa(sInAddr);
printf("Agent address : %s\n", strIpAddress);

and the result is 0.0.0.0 as said in the previous letter.

I think the address I got is the agent address, why the result is 0.0.0.0,
Is it needed to set, how to set it?
The second question is that how can I get the address of ip packets?
Thank you !
yao yu

------=_Part_171364_6882790.1179067770401
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Aluisio Leonelo Victal,

 > I belive that you want de source address of ip packets, but i need more
 >information about the "struct pdu" and any another information about how
 >you catch the packets.
 

 I used net-snmp-5.3.0.1, I also used snmptrapd_add_session(netsnmp_transport *transport) to get the packet, and in the function callback function --- snmp_input is used to process an incoming trap through calling a new function------trap_message_handler(netsnmp_pdu *, netsnmp_trapsport *, netsnmp_trapd_handler *)  which I add.  The pdu is a struct netsnmp_pdu, and unsigned char agent_addr[4] is the a item of the struct, I get the ip through agent_addr as follow:

 

char *strIpAddress;

struct in_addr sInAddr = *(struct in_addr *)pdu->agent_addr;
strIpAddress = inet_ntoa(sInAddr);

 printf("Agent address  : %s\n", strIpAddress);

 

and the result is 0.0.0.0 as said in the previous letter. 

 

I think the address I got is the agent address, why the result is 0.0.0.0, Is it needed to set, how to set it?

The second question is that how can I get the address of ip packets?

Thank you !

                                                                       yao yu


------=_Part_171364_6882790.1179067770401--


--===============1261770687==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--===============1261770687==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders

--===============1261770687==--