Hi,

I know how to do this in python:

    if packet.type == ethernet.ARP_TYPE and packet.next.opcode == arp.REQUEST:
      if packet.next.protodst in arp_dict.keys():
         arp_reply_packet =
array_to_str(packet.src)+arp_dict[packet.next.protodst]+....
         inst.send_openflow_packet(dpid, array.array('B',
arp_reply_packet.decode("hex")), inport, openflow.OFPP_NONE)
      return CONTINUE

but now I need to write it in a C++ component:

    Disposition handler(const Event& e)
    {
        const Ofp_msg_event& pi = assert_cast<const Ofp_msg_event&>(e);
        struct ofl_msg_packet_in *in = (struct ofl_msg_packet_in *)**pi.msg;

        Flow *flow = new Flow((struct ofl_match*) in->match);

        uint16_t dl_type;

        flow->get_Field<uint16_t>("eth_type",&dl_type);
        flow->get_Field("eth_src", eth_src);
        flow->get_Field("eth_dst", eth_dst);
        flow->get_Field<uint32_t>("in_port", &in_port);

        if (dl_type == ethernet::LLDP){
             return CONTINUE;
        }

        if (dl_type == 0x0806){
             /* Send an ARP reply */
        }

What I want to know is what function should I use in place of
send_openflow_packet and how do I parse the incoming packet to get ARP
target IP address, source IP address etc.

Thanks,

Dushyant

Reply via email to