[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] source address in application



Greetings,

The receiving application in my model needs access to the source IP
address and port (it is modeling the UDP based recvfrom() interface).

The UDP agent code I'm using calls the application model in the
following manner in its recv method:

    if (app_ == 0) 
        return;
    app_->process_data(pkt->datalen(), pkt->userdata());

Any suggestions how to surface the information (struct sockadddr) that
is normally returned to the application layer by the recvfrom() socket
interface?

I'm currently considering creating a derived class of Application that
defines process_data() with an additional Packet * argument.  This
will allow the application to use the hdr_ip::access method to get the
transport reported source address and port.  Instances of this
Application class would *need* to be connected to modified Agent
classes that provided the extra argument in the call.

Is there a better way?

Many thanks in advance ...

Ken

Ken Sedgwick
Zodiac Networks
[email protected]