<?xml version='1.0' encoding='UTF-8' standalone='no'?> <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16"> <compounddef id="arp_8c" kind="file" language="C++"> <compoundname>arp.c</compoundname> <includes refid="include_2sys_2types_8h" local="no">sys/types.h</includes> <includes refid="kprintf_8h" local="no">lib/kprintf.h</includes> <includes refid="debug_8h" local="yes">net/debug.h</includes> <includes local="yes">net/ipv4/inet.h</includes> <includes local="yes">netif/arp.h</includes> <includes local="yes">net/ipv4/ip.h</includes> <incdepgraph> <node id="1"> <label>C:/Dev/git/UbixOS/sys/net/netif/arp.c</label> <link refid="arp_8c"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="9" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> <childnode refid="19" relation="include"> </childnode> <childnode refid="20" relation="include"> </childnode> <childnode refid="21" relation="include"> </childnode> </node> <node id="10"> <label>stdarg.h</label> <link refid="stdarg_8h"/> </node> <node id="16"> <label>ubixos/kpanic.h</label> <link refid="kpanic_8h"/> </node> <node id="15"> <label>sys/io.h</label> <link refid="io_8h"/> </node> <node id="19"> <label>net/ipv4/inet.h</label> </node> <node id="4"> <label>sys/select.h</label> <link refid="select_8h"/> <childnode refid="5" relation="include"> </childnode> <childnode refid="3" relation="include"> </childnode> <childnode refid="6" relation="include"> </childnode> <childnode refid="7" relation="include"> </childnode> <childnode refid="8" relation="include"> </childnode> </node> <node id="13"> <label>net/arch/cc.h</label> <link refid="cc_8h"/> <childnode refid="14" relation="include"> </childnode> </node> <node id="8"> <label>sys/_sigset.h</label> <link refid="__sigset_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="18"> <label>net/lwipopts.h</label> <link refid="lwipopts_8h"/> </node> <node id="2"> <label>sys/types.h</label> <link refid="include_2sys_2types_8h"/> <childnode refid="3" relation="include"> </childnode> <childnode refid="4" relation="include"> </childnode> </node> <node id="12"> <label>net/arch.h</label> <link refid="arch_8h"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="13" relation="include"> </childnode> <childnode refid="9" relation="include"> </childnode> <childnode refid="16" relation="include"> </childnode> </node> <node id="17"> <label>net/opt.h</label> <link refid="opt_8h"/> <childnode refid="18" relation="include"> </childnode> <childnode refid="11" relation="include"> </childnode> </node> <node id="9"> <label>lib/kprintf.h</label> <link refid="kprintf_8h"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="10" relation="include"> </childnode> </node> <node id="11"> <label>net/debug.h</label> <link refid="debug_8h"/> <childnode refid="12" relation="include"> </childnode> <childnode refid="17" relation="include"> </childnode> </node> <node id="20"> <label>netif/arp.h</label> </node> <node id="5"> <label>sys/cdefs.h</label> <link refid="cdefs_8h"/> </node> <node id="14"> <label>ubixos/time.h</label> <link refid="time_8h"/> <childnode refid="2" relation="include"> </childnode> <childnode refid="6" relation="include"> </childnode> <childnode refid="15" relation="include"> </childnode> </node> <node id="3"> <label>sys/_types.h</label> <link refid="__types_8h"/> </node> <node id="21"> <label>net/ipv4/ip.h</label> </node> <node id="6"> <label>sys/_timespec.h</label> <link refid="__timespec_8h"/> <childnode refid="3" relation="include"> </childnode> </node> <node id="7"> <label>sys/_timeval.h</label> <link refid="__timeval_8h"/> <childnode refid="3" relation="include"> </childnode> </node> </incdepgraph> <innerclass refid="structarp__entry" prot="public">arp_entry</innerclass> <innerclass refid="structarp__hdr" prot="public">arp_hdr</innerclass> <innerclass refid="structethip__hdr" prot="public">ethip_hdr</innerclass> <sectiondef kind="define"> <memberdef kind="define" id="arp_8c_1a741a0710dc126ed3ae9e305472df3432" prot="public" static="no"> <name>ARP_MAXAGE</name> <initializer>2 /* 120 * 10 seconds = 20 minutes. */</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="46" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="46" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1a06ba7b414e718081998f2814090debf1" prot="public" static="no"> <name>ARP_REPLY</name> <initializer>2</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="51" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="51" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" prot="public" static="no"> <name>ARP_REQUEST</name> <initializer>1</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="50" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="50" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1a06faf2eae13476a702524b13ea6ecd7f" prot="public" static="no"> <name>ARPH_HWLEN</name> <param><defname>hdr</defname></param> <initializer>(NTOHS((hdr)->_hwlen_protolen) >> 8)</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="68" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="68" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" prot="public" static="no"> <name>ARPH_HWLEN_SET</name> <param><defname>hdr</defname></param> <param><defname>len</defname></param> <initializer>(hdr)->_hwlen_protolen = HTONS(<ref refid="arp_8c_1a8c416438814934662a28d7e3c891a175" kindref="member">ARPH_PROTOLEN</ref>(hdr) | ((len) << 8))</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="72" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="72" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1a8c416438814934662a28d7e3c891a175" prot="public" static="no"> <name>ARPH_PROTOLEN</name> <param><defname>hdr</defname></param> <initializer>(NTOHS((hdr)->_hwlen_protolen) & 0xff)</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="69" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="69" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1aedb2ded9225b09da0358754f859d72d6" prot="public" static="no"> <name>ARPH_PROTOLEN_SET</name> <param><defname>hdr</defname></param> <param><defname>len</defname></param> <initializer>(hdr)->_hwlen_protolen = HTONS((len) | (<ref refid="arp_8c_1a06faf2eae13476a702524b13ea6ecd7f" kindref="member">ARPH_HWLEN</ref>(hdr) << 8))</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="73" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="73" bodyend="-1"/> </memberdef> <memberdef kind="define" id="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" prot="public" static="no"> <name>HWTYPE_ETHERNET</name> <initializer>1</initializer> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="48" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="48" bodyend="-1"/> </memberdef> </sectiondef> <sectiondef kind="var"> <memberdef kind="variable" id="arp_8c_1af695765e961406ffcbd5a25a4dca7a55" prot="public" static="yes" mutable="no"> <type>struct <ref refid="structarp__entry" kindref="compound">arp_entry</ref></type> <definition>struct arp_entry arp_table[ARP_TABLE_SIZE]</definition> <argsstring>[ARP_TABLE_SIZE]</argsstring> <name>arp_table</name> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="80" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="88" bodyend="-1"/> </memberdef> <memberdef kind="variable" id="arp_8c_1a9b78800fdadcc20482aacd10da639621" prot="public" static="yes" mutable="no"> <type><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref></type> <definition>uInt8 ctime</definition> <argsstring></argsstring> <name>ctime</name> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="89" column="14" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="89" bodyend="-1"/> </memberdef> <memberdef kind="variable" id="arp_8c_1ab335643ec08d519342c9d3834091d6e0" prot="public" static="no" mutable="no"> <type><ref refid="group__compiler__abstraction_1ga73199061891adf1b912d20835c7d5e96" kindref="member">PACK_STRUCT_BEGIN</ref> struct <ref refid="structarp__hdr" kindref="compound">arp_hdr</ref></type> <definition>PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT</definition> <argsstring></argsstring> <name>PACK_STRUCT_STRUCT</name> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="65" column="20"/> </memberdef> </sectiondef> <sectiondef kind="func"> <memberdef kind="function" id="arp_8c_1a038bb8fc3bcc993d8b7724632e43ed0f" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>static void add_arp_entry</definition> <argsstring>(struct ip_addr *ipaddr, struct eth_addr *ethaddr)</argsstring> <name>add_arp_entry</name> <param> <type>struct ip_addr *</type> <declname>ipaddr</declname> </param> <param> <type>struct <ref refid="structeth__addr" kindref="compound">eth_addr</ref> *</type> <declname>ethaddr</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="120" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="120" bodyend="178"/> </memberdef> <memberdef kind="function" id="arp_8c_1a57a25dd51cf73f048ad5364ecc2f040b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <definition>struct pbuf* arp_arp_input</definition> <argsstring>(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)</argsstring> <name>arp_arp_input</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <param> <type>struct <ref refid="structeth__addr" kindref="compound">eth_addr</ref> *</type> <declname>ethaddr</declname> </param> <param> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <declname>p</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="197" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="197" bodyend="257"/> <references refid="arp_8c_1a06ba7b414e718081998f2814090debf1" compoundref="arp_8c" startline="51">ARP_REPLY</references> <references refid="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" compoundref="arp_8c" startline="50">ARP_REQUEST</references> <references refid="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" compoundref="arp_8c" startline="72">ARPH_HWLEN_SET</references> <references refid="arp_8c_1aedb2ded9225b09da0358754f859d72d6" compoundref="arp_8c" startline="73">ARPH_PROTOLEN_SET</references> <references refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" compoundref="prot_2ethernet_8h" startline="112">ETHTYPE_ARP</references> <references refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" compoundref="prot_2ethernet_8h" startline="110">ETHTYPE_IP</references> <references refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" compoundref="def_8h" startline="108">htons</references> <references refid="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" compoundref="arp_8c" startline="48">HWTYPE_ETHERNET</references> <references refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" compoundref="ip__addr_8h" startline="316">ip_addr_cmp</references> <references refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" compoundref="ip__addr_8h" startline="307">ip_addr_set</references> <references refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" compoundref="kprintf_8c" startline="259" endline="276">kprintf</references> <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references> <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references> <references refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" compoundref="pbuf_8c" startline="715" endline="792">pbuf_free</references> <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references> </memberdef> <memberdef kind="function" id="arp_8c_1ac8ad5a32790d172fcec2eac97a87ee9f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void arp_init</definition> <argsstring>(void)</argsstring> <name>arp_init</name> <param> <type>void</type> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="93" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="93" bodyend="101"/> <references refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" compoundref="lwipopts_8h" startline="91">ARP_TABLE_SIZE</references> <references refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" compoundref="ip__addr_8h" startline="307">ip_addr_set</references> </memberdef> <memberdef kind="function" id="arp_8c_1a916d08dbb8f4a38e1e904a8a018b000c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void arp_ip_input</definition> <argsstring>(struct netif *netif, struct pbuf *p)</argsstring> <name>arp_ip_input</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <param> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <declname>p</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="181" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="181" bodyend="194"/> <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references> </memberdef> <memberdef kind="function" id="arp_8c_1aeec8fff4f036cca2ac1b5635fa46d21b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>struct <ref refid="structeth__addr" kindref="compound">eth_addr</ref> *</type> <definition>struct eth_addr* arp_lookup</definition> <argsstring>(struct ip_addr *ipaddr)</argsstring> <name>arp_lookup</name> <param> <type>struct ip_addr *</type> <declname>ipaddr</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="260" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="260" bodyend="270"/> <references refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" compoundref="lwipopts_8h" startline="91">ARP_TABLE_SIZE</references> <references refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" compoundref="ip__addr_8h" startline="316">ip_addr_cmp</references> </memberdef> <memberdef kind="function" id="arp_8c_1a9d1287b9a80c370797b2ac5c63f70e2e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type> <definition>struct pbuf* arp_query</definition> <argsstring>(struct netif *netif, struct eth_addr *ethaddr, struct ip_addr *ipaddr)</argsstring> <name>arp_query</name> <param> <type>struct <ref refid="structnetif" kindref="compound">netif</ref> *</type> <declname>netif</declname> </param> <param> <type>struct <ref refid="structeth__addr" kindref="compound">eth_addr</ref> *</type> <declname>ethaddr</declname> </param> <param> <type>struct ip_addr *</type> <declname>ipaddr</declname> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="273" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="273" bodyend="309"/> <references refid="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" compoundref="arp_8c" startline="50">ARP_REQUEST</references> <references refid="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" compoundref="arp_8c" startline="72">ARPH_HWLEN_SET</references> <references refid="arp_8c_1aedb2ded9225b09da0358754f859d72d6" compoundref="arp_8c" startline="73">ARPH_PROTOLEN_SET</references> <references refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" compoundref="prot_2ethernet_8h" startline="112">ETHTYPE_ARP</references> <references refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" compoundref="prot_2ethernet_8h" startline="110">ETHTYPE_IP</references> <references refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" compoundref="def_8h" startline="108">htons</references> <references refid="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" compoundref="arp_8c" startline="48">HWTYPE_ETHERNET</references> <references refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" compoundref="ip__addr_8h" startline="307">ip_addr_set</references> <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references> <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references> <references refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" compoundref="pbuf_8c" startline="248" endline="405">pbuf_alloc</references> <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" compoundref="pbuf_8h" startline="85">PBUF_LINK</references> <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" compoundref="pbuf_8h" startline="108">PBUF_RAM</references> </memberdef> <memberdef kind="function" id="arp_8c_1a2cc298ed4c68289160da1376faf20938" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>void</type> <definition>void arp_tmr</definition> <argsstring>(void)</argsstring> <name>arp_tmr</name> <param> <type>void</type> </param> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <inbodydescription> </inbodydescription> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c" line="104" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/netif/arp.c" bodystart="104" bodyend="117"/> </memberdef> </sectiondef> <briefdescription> </briefdescription> <detaileddescription> </detaileddescription> <programlisting> <codeline lineno="1"><highlight class="comment">/*</highlight></codeline> <codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001,<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline> <codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.<sp/></highlight></codeline> <codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="5"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/></highlight></codeline> <codeline lineno="6"><highlight class="comment"><sp/>*<sp/>modification,<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/></highlight></codeline> <codeline lineno="7"><highlight class="comment"><sp/>*<sp/>are<sp/>met:<sp/></highlight></codeline> <codeline lineno="8"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/></highlight></codeline> <codeline lineno="9"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.<sp/></highlight></codeline> <codeline lineno="10"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/></highlight></codeline> <codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/></highlight></codeline> <codeline lineno="12"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>documentation<sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.<sp/></highlight></codeline> <codeline lineno="13"><highlight class="comment"><sp/>*<sp/>3.<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>Institute<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/></highlight></codeline> <codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>may<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/></highlight></codeline> <codeline lineno="15"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.<sp/></highlight></codeline> <codeline lineno="16"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="17"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>INSTITUTE<sp/>AND<sp/>CONTRIBUTORS<sp/>``AS<sp/>IS''<sp/>AND<sp/></highlight></codeline> <codeline lineno="18"><highlight class="comment"><sp/>*<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/></highlight></codeline> <codeline lineno="19"><highlight class="comment"><sp/>*<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/></highlight></codeline> <codeline lineno="20"><highlight class="comment"><sp/>*<sp/>ARE<sp/>DISCLAIMED.<sp/><sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>INSTITUTE<sp/>OR<sp/>CONTRIBUTORS<sp/>BE<sp/>LIABLE<sp/></highlight></codeline> <codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/></highlight></codeline> <codeline lineno="22"><highlight class="comment"><sp/>*<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/></highlight></codeline> <codeline lineno="23"><highlight class="comment"><sp/>*<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/></highlight></codeline> <codeline lineno="24"><highlight class="comment"><sp/>*<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>CONTRACT,<sp/>STRICT<sp/></highlight></codeline> <codeline lineno="25"><highlight class="comment"><sp/>*<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/></highlight></codeline> <codeline lineno="26"><highlight class="comment"><sp/>*<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/></highlight></codeline> <codeline lineno="27"><highlight class="comment"><sp/>*<sp/>SUCH<sp/>DAMAGE.<sp/></highlight></codeline> <codeline lineno="28"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="29"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline> <codeline lineno="30"><highlight class="comment"><sp/>*<sp/></highlight></codeline> <codeline lineno="31"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/><adam@sics.se></highlight></codeline> <codeline lineno="32"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="33"><highlight class="comment"><sp/>*<sp/>$Id:<sp/>arp.c<sp/>54<sp/>2016-01-11<sp/>01:29:55Z<sp/>reddawg<sp/>$</highlight></codeline> <codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline> <codeline lineno="35"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="36"><highlight class="normal"></highlight></codeline> <codeline lineno="37"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="include_2sys_2types_8h" kindref="compound">sys/types.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="kprintf_8h" kindref="compound">lib/kprintf.h</ref>></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="39"><highlight class="normal"></highlight></codeline> <codeline lineno="40"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="debug_8h" kindref="compound">net/debug.h</ref>"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="41"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"net/ipv4/inet.h"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="42"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"netif/arp.h"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="43"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"net/ipv4/ip.h"</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="44"><highlight class="normal"></highlight></codeline> <codeline lineno="45"><highlight class="normal"></highlight></codeline> <codeline lineno="46" refid="arp_8c_1a741a0710dc126ed3ae9e305472df3432" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARP_MAXAGE<sp/>2<sp/><sp/></highlight><highlight class="comment">/*<sp/>120<sp/>*<sp/>10<sp/>seconds<sp/>=<sp/>20<sp/>minutes.<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> <codeline lineno="47"><highlight class="normal"></highlight></codeline> <codeline lineno="48" refid="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>HWTYPE_ETHERNET<sp/>1</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="49"><highlight class="normal"></highlight></codeline> <codeline lineno="50" refid="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARP_REQUEST<sp/>1</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="51" refid="arp_8c_1a06ba7b414e718081998f2814090debf1" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARP_REPLY<sp/>2</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="52"><highlight class="normal"></highlight></codeline> <codeline lineno="53"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>MUST<sp/>be<sp/>compiled<sp/>with<sp/>"pack<sp/>structs"<sp/>or<sp/>equivalent!<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="54"><highlight class="normal"><ref refid="cc_8h_1a73199061891adf1b912d20835c7d5e96" kindref="member">PACK_STRUCT_BEGIN</ref></highlight></codeline> <codeline lineno="55" refid="structarp__hdr" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref><sp/>{</highlight></codeline> <codeline lineno="56"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__hdr" kindref="compound">eth_hdr</ref><sp/>ethhdr);</highlight></codeline> <codeline lineno="57"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="objgfx30_8h_1a81f3b46fa4ddd984830104840a08da82" kindref="member">uInt16</ref><sp/>hwtype);</highlight></codeline> <codeline lineno="58"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="objgfx30_8h_1a81f3b46fa4ddd984830104840a08da82" kindref="member">uInt16</ref><sp/>proto);</highlight></codeline> <codeline lineno="59"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="objgfx30_8h_1a81f3b46fa4ddd984830104840a08da82" kindref="member">uInt16</ref><sp/>_hwlen_protolen);</highlight></codeline> <codeline lineno="60"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="objgfx30_8h_1a81f3b46fa4ddd984830104840a08da82" kindref="member">uInt16</ref><sp/>opcode);</highlight></codeline> <codeline lineno="61"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>shwaddr);</highlight></codeline> <codeline lineno="62"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr<sp/>sipaddr);</highlight></codeline> <codeline lineno="63"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>dhwaddr);</highlight></codeline> <codeline lineno="64"><highlight class="normal"><sp/><sp/><ref refid="structarp__hdr_1abf562b78f962f27cb93c538f42c6fe79" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr<sp/>dipaddr);</highlight></codeline> <codeline lineno="65"><highlight class="normal">}<sp/><ref refid="arp_8c_1ab335643ec08d519342c9d3834091d6e0" kindref="member">PACK_STRUCT_STRUCT</ref>;</highlight></codeline> <codeline lineno="66"><highlight class="normal"><ref refid="cc_8h_1a465fef70f294e21cbf4ea51fc342f20e" kindref="member">PACK_STRUCT_END</ref></highlight></codeline> <codeline lineno="67"><highlight class="normal"></highlight></codeline> <codeline lineno="68" refid="arp_8c_1a06faf2eae13476a702524b13ea6ecd7f" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARPH_HWLEN(hdr)<sp/>(NTOHS((hdr)->_hwlen_protolen)<sp/>>><sp/>8)</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="69" refid="arp_8c_1a8c416438814934662a28d7e3c891a175" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARPH_PROTOLEN(hdr)<sp/>(NTOHS((hdr)->_hwlen_protolen)<sp/>&<sp/>0xff)</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="70"><highlight class="normal"></highlight></codeline> <codeline lineno="71"><highlight class="normal"></highlight></codeline> <codeline lineno="72" refid="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARPH_HWLEN_SET(hdr,<sp/>len)<sp/>(hdr)->_hwlen_protolen<sp/>=<sp/>HTONS(ARPH_PROTOLEN(hdr)<sp/>|<sp/>((len)<sp/><<<sp/>8))</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="73" refid="arp_8c_1aedb2ded9225b09da0358754f859d72d6" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARPH_PROTOLEN_SET(hdr,<sp/>len)<sp/>(hdr)->_hwlen_protolen<sp/>=<sp/>HTONS((len)<sp/>|<sp/>(ARPH_HWLEN(hdr)<sp/><<<sp/>8))</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="74"><highlight class="normal"></highlight></codeline> <codeline lineno="75"><highlight class="normal"><ref refid="cc_8h_1a73199061891adf1b912d20835c7d5e96" kindref="member">PACK_STRUCT_BEGIN</ref></highlight></codeline> <codeline lineno="76" refid="structethip__hdr" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethip__hdr" kindref="compound">ethip_hdr</ref><sp/>{</highlight></codeline> <codeline lineno="77"><highlight class="normal"><sp/><sp/><ref refid="structethip__hdr_1aeaff5bdb00c5618ea94cc70081ba27d9" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__hdr" kindref="compound">eth_hdr</ref><sp/>eth);</highlight></codeline> <codeline lineno="78"><highlight class="normal"><sp/><sp/><ref refid="structethip__hdr_1aeaff5bdb00c5618ea94cc70081ba27d9" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>ip);</highlight></codeline> <codeline lineno="79"><highlight class="normal">};</highlight></codeline> <codeline lineno="80"><highlight class="normal"><ref refid="cc_8h_1a465fef70f294e21cbf4ea51fc342f20e" kindref="member">PACK_STRUCT_END</ref></highlight></codeline> <codeline lineno="81"><highlight class="normal"></highlight></codeline> <codeline lineno="82" refid="structarp__entry" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structarp__entry" kindref="compound">arp_entry</ref><sp/>{</highlight></codeline> <codeline lineno="83" refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip_addr<sp/><ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>;</highlight></codeline> <codeline lineno="84" refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/><ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>;</highlight></codeline> <codeline lineno="85" refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="86"><highlight class="normal">};</highlight></codeline> <codeline lineno="87"><highlight class="normal"></highlight></codeline> <codeline lineno="88"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structarp__entry" kindref="compound">arp_entry</ref><sp/>arp_table[<ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>];</highlight></codeline> <codeline lineno="89"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="90"><highlight class="normal"></highlight></codeline> <codeline lineno="91"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="92"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="93" refid="arp_8c_1ac8ad5a32790d172fcec2eac97a87ee9f" refkind="member"><highlight class="normal"><ref refid="arp_8c_1ac8ad5a32790d172fcec2eac97a87ee9f" kindref="member">arp_init</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline> <codeline lineno="94"><highlight class="normal">{</highlight></codeline> <codeline lineno="95"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i;</highlight></codeline> <codeline lineno="96"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>),</highlight></codeline> <codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>IP_ADDR_ANY);</highlight></codeline> <codeline lineno="100"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="101"><highlight class="normal">}</highlight></codeline> <codeline lineno="102"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="103"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="104" refid="arp_8c_1a2cc298ed4c68289160da1376faf20938" refkind="member"><highlight class="normal"><ref refid="arp_8c_1a2cc298ed4c68289160da1376faf20938" kindref="member">arp_tmr</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline> <codeline lineno="105"><highlight class="normal">{</highlight></codeline> <codeline lineno="106"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i;</highlight></codeline> <codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="108"><highlight class="normal"><sp/><sp/>++<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="109"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(&arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>)<sp/>&&<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>-<sp/>arp_table[i].<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>>=<sp/><ref refid="arp_8c_1a741a0710dc126ed3ae9e305472df3432" kindref="member">ARP_MAXAGE</ref>)<sp/>{</highlight></codeline> <codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>DEBUGF(ARP_DEBUG,<sp/>(</highlight><highlight class="stringliteral">"arp_timer:<sp/>expired<sp/>entry<sp/>%d.\n"</highlight><highlight class="normal">,<sp/>i));</highlight></codeline> <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>),</highlight></codeline> <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>IP_ADDR_ANY);</highlight></codeline> <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="116"><highlight class="normal"><sp/><sp/>}<sp/><sp/></highlight></codeline> <codeline lineno="117"><highlight class="normal">}</highlight></codeline> <codeline lineno="118"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="119"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="120"><highlight class="normal">add_arp_entry(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr<sp/>*<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*<ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>)</highlight></codeline> <codeline lineno="121"><highlight class="normal">{</highlight></codeline> <codeline lineno="122"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i,<sp/>j,<sp/>k;</highlight></codeline> <codeline lineno="123"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>maxtime;</highlight></codeline> <codeline lineno="124"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="125"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Walk<sp/>through<sp/>the<sp/>ARP<sp/>mapping<sp/>table<sp/>and<sp/>try<sp/>to<sp/>find<sp/>an<sp/>entry<sp/>to</highlight></codeline> <codeline lineno="126"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>update.<sp/>If<sp/>none<sp/>is<sp/>found,<sp/>the<sp/>IP<sp/>-><sp/>MAC<sp/>address<sp/>mapping<sp/>is</highlight></codeline> <codeline lineno="127"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>inserted<sp/>in<sp/>the<sp/>ARP<sp/>table.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="128"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Only<sp/>check<sp/>those<sp/>entries<sp/>that<sp/>are<sp/>actually<sp/>in<sp/>use.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(&arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>))<sp/>{</highlight></codeline> <codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>source<sp/>IP<sp/>address<sp/>of<sp/>the<sp/>incoming<sp/>packet<sp/>matches</highlight></codeline> <codeline lineno="133"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>the<sp/>IP<sp/>address<sp/>in<sp/>this<sp/>ARP<sp/>table<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>,<sp/>&arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>))<sp/>{</highlight></codeline> <codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>An<sp/>old<sp/>entry<sp/>found,<sp/>update<sp/>this<sp/>and<sp/>return.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(k<sp/>=<sp/>0;<sp/>k<sp/><<sp/>6;<sp/>++k)<sp/>{</highlight></codeline> <codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].<ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>.addr[k]<sp/>=<sp/><ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>->addr[k];</highlight></codeline> <codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>=<sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="143"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="144"><highlight class="normal"></highlight></codeline> <codeline lineno="145"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>get<sp/>here,<sp/>no<sp/>existing<sp/>ARP<sp/>table<sp/>entry<sp/>was<sp/>found,<sp/>so<sp/>we</highlight></codeline> <codeline lineno="146"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>create<sp/>one.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="147"><highlight class="normal"></highlight></codeline> <codeline lineno="148"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>First,<sp/>we<sp/>try<sp/>to<sp/>find<sp/>an<sp/>unused<sp/>entry<sp/>in<sp/>the<sp/>ARP<sp/>table.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="149"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a279118890e6a90aa740051fb8b0cc5f4" kindref="member">ip_addr_isany</ref>(&arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>))<sp/>{</highlight></codeline> <codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="153"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="154"><highlight class="normal"></highlight></codeline> <codeline lineno="155"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>no<sp/>unused<sp/>entry<sp/>is<sp/>found,<sp/>we<sp/>try<sp/>to<sp/>find<sp/>the<sp/>oldest<sp/>entry<sp/>and</highlight></codeline> <codeline lineno="156"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>throw<sp/>it<sp/>away.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="157"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(i<sp/>==<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline> <codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/>maxtime<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/>j<sp/>=<sp/>0;</highlight></codeline> <codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>-<sp/>arp_table[i].<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>><sp/>maxtime)<sp/>{</highlight></codeline> <codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>maxtime<sp/>=<sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>-<sp/>arp_table[i].<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i;</highlight></codeline> <codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>j;</highlight></codeline> <codeline lineno="167"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="168"><highlight class="normal"></highlight></codeline> <codeline lineno="169"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now,<sp/>i<sp/>is<sp/>the<sp/>ARP<sp/>table<sp/>entry<sp/>which<sp/>we<sp/>will<sp/>fill<sp/>with<sp/>the<sp/>new</highlight></codeline> <codeline lineno="170"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>information.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="171"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&arp_table[i].<ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>,<sp/><ref refid="structarp__entry_1ab9ee1643a380bd563aac0dea83973459" kindref="member">ipaddr</ref>);</highlight></codeline> <codeline lineno="172"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(k<sp/>=<sp/>0;<sp/>k<sp/><<sp/>6;<sp/>++k)<sp/>{</highlight></codeline> <codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].<ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>.addr[k]<sp/>=<sp/><ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>->addr[k];</highlight></codeline> <codeline lineno="174"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="175"><highlight class="normal"><sp/><sp/>arp_table[i].<ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref><sp/>=<sp/><ref refid="structarp__entry_1a49945e8299d4bf7241c0fd2b5e4d84df" kindref="member">ctime</ref>;</highlight></codeline> <codeline lineno="176"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="177"><highlight class="normal"></highlight></codeline> <codeline lineno="178"><highlight class="normal">}</highlight></codeline> <codeline lineno="179"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="180"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="181" refid="arp_8c_1a916d08dbb8f4a38e1e904a8a018b000c" refkind="member"><highlight class="normal"><ref refid="arp_8c_1a916d08dbb8f4a38e1e904a8a018b000c" kindref="member">arp_ip_input</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline> <codeline lineno="182"><highlight class="normal">{</highlight></codeline> <codeline lineno="183"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structethip__hdr" kindref="compound">ethip_hdr</ref><sp/>*hdr;</highlight></codeline> <codeline lineno="184"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="185"><highlight class="normal"><sp/><sp/>hdr<sp/>=<sp/>p-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline> <codeline lineno="186"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="187"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Only<sp/>insert/update<sp/>an<sp/>entry<sp/>if<sp/>the<sp/>source<sp/>IP<sp/>address<sp/>of<sp/>the</highlight></codeline> <codeline lineno="188"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>incoming<sp/>IP<sp/>packet<sp/>comes<sp/>from<sp/>a<sp/>host<sp/>on<sp/>the<sp/>local<sp/>network.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="189"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(!ip_addr_maskcmp(&(hdr->ip.src),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->ip_addr),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->netmask)))<sp/>{</highlight></codeline> <codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="191"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="192"><highlight class="normal"><sp/><sp/>DEBUGF(ARP_DEBUG,<sp/>(</highlight><highlight class="stringliteral">"arp_ip_input:<sp/>updating<sp/>ARP<sp/>table.\n"</highlight><highlight class="normal">));</highlight></codeline> <codeline lineno="193"><highlight class="normal"><sp/><sp/>add_arp_entry(&(hdr->ip.src),<sp/>&(hdr->eth.src));</highlight></codeline> <codeline lineno="194"><highlight class="normal">}</highlight></codeline> <codeline lineno="195"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="196"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline> <codeline lineno="197" refid="arp_8c_1a57a25dd51cf73f048ad5364ecc2f040b" refkind="member"><highlight class="normal"><ref refid="arp_8c_1a57a25dd51cf73f048ad5364ecc2f040b" kindref="member">arp_arp_input</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline> <codeline lineno="198"><highlight class="normal">{</highlight></codeline> <codeline lineno="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref><sp/>*hdr;</highlight></codeline> <codeline lineno="200"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i;</highlight></codeline> <codeline lineno="201"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(p-><ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/><<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref>))<sp/>{</highlight></codeline> <codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"arp_arp_input:<sp/>packet<sp/>too<sp/>short<sp/>(%d/%d)\n"</highlight><highlight class="normal">,<sp/>p-><ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref>));</highlight></codeline> <codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline> <codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline> <codeline lineno="206"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="207"><highlight class="normal"></highlight></codeline> <codeline lineno="208"><highlight class="normal"><sp/><sp/>hdr<sp/>=<sp/>p-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline> <codeline lineno="209"><highlight class="normal"></highlight></codeline> <codeline lineno="210"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//kprintf("HDR->OPCODE:<sp/>[0x%X]\n",<sp/>hdr->opcode);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="212"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(<ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(hdr->opcode))<sp/>{</highlight></codeline> <codeline lineno="213"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" kindref="member">ARP_REQUEST</ref>:</highlight></codeline> <codeline lineno="214"><highlight class="normal"><sp/></highlight><highlight class="comment">//<sp/><sp/><sp/>kprintf("ARP_REQUEST");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="215"><highlight class="normal"></highlight><highlight class="comment">//ip_addr_debug_print(&hdr->dipaddr);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="216"><highlight class="normal"></highlight><highlight class="comment">//ip_addr_debug_print(&netif->ip_addr);</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>request.<sp/>If<sp/>it<sp/>asked<sp/>for<sp/>our<sp/>address,<sp/>we<sp/>send<sp/>out<sp/>a</highlight></codeline> <codeline lineno="218"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>reply.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&(hdr->dipaddr),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->ip_addr)))<sp/>{</highlight></codeline> <codeline lineno="220"><highlight class="normal"></highlight><highlight class="comment">//kprintf("MATCHED!\n");</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hdr->opcode<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="arp_8c_1a06ba7b414e718081998f2814090debf1" kindref="member">ARP_REPLY</ref>);</highlight></codeline> <codeline lineno="222"><highlight class="normal"></highlight></codeline> <codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(hdr->dipaddr),<sp/>&(hdr->sipaddr));</highlight></codeline> <codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(hdr->sipaddr),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->ip_addr));</highlight></codeline> <codeline lineno="225"><highlight class="normal"></highlight></codeline> <codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>6;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>hdr->dhwaddr.addr[i]<sp/>=<sp/>hdr->shwaddr.addr[i];</highlight></codeline> <codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>hdr->shwaddr.addr[i]<sp/>=<sp/>ethaddr->addr[i];</highlight></codeline> <codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>hdr->ethhdr.dest.addr[i]<sp/>=<sp/>hdr->dhwaddr.addr[i];</highlight></codeline> <codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>hdr->ethhdr.src.addr[i]<sp/>=<sp/>ethaddr->addr[i];</highlight></codeline> <codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="232"><highlight class="normal"></highlight></codeline> <codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hdr->hwtype<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" kindref="member">HWTYPE_ETHERNET</ref>);</highlight></codeline> <codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" kindref="member">ARPH_HWLEN_SET</ref>(hdr,<sp/>6);</highlight></codeline> <codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hdr->proto<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline> <codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="arp_8c_1aedb2ded9225b09da0358754f859d72d6" kindref="member">ARPH_PROTOLEN_SET</ref>(hdr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr));<sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hdr->ethhdr.type<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" kindref="member">ETHTYPE_ARP</ref>);<sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline> <codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="243"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="arp_8c_1a06ba7b414e718081998f2814090debf1" kindref="member">ARP_REPLY</ref>:<sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"ARP_RREPLY"</highlight><highlight class="normal">);</highlight></codeline> <codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>reply.<sp/>We<sp/>insert<sp/>or<sp/>update<sp/>the<sp/>ARP<sp/>table.<sp/>*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&(hdr->dipaddr),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->ip_addr)))<sp/>{</highlight></codeline> <codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>add_arp_entry(&(hdr->sipaddr),<sp/>&(hdr->shwaddr));</highlight></codeline> <codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="250"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline> <codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">"arp_arp_input:<sp/>unknown<sp/>type<sp/>%d\n"</highlight><highlight class="normal">,<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(hdr->opcode));</highlight></codeline> <codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline> <codeline lineno="253"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="254"><highlight class="normal"></highlight></codeline> <codeline lineno="255"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline> <codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline> <codeline lineno="257"><highlight class="normal">}</highlight></codeline> <codeline lineno="258"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="259"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*</highlight></codeline> <codeline lineno="260" refid="arp_8c_1aeec8fff4f036cca2ac1b5635fa46d21b" refkind="member"><highlight class="normal"><ref refid="arp_8c_1aeec8fff4f036cca2ac1b5635fa46d21b" kindref="member">arp_lookup</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr<sp/>*ipaddr)</highlight></codeline> <codeline lineno="261"><highlight class="normal">{</highlight></codeline> <codeline lineno="262"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i;</highlight></codeline> <codeline lineno="263"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="264"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(ipaddr,<sp/>&arp_table[i].ipaddr))<sp/>{</highlight></codeline> <codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>&arp_table[i].<ref refid="structarp__entry_1a4cd78dd42071f584f2b8a5ead9f70eaf" kindref="member">ethaddr</ref>;</highlight></codeline> <codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline> <codeline lineno="268"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="269"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/><sp/></highlight></codeline> <codeline lineno="270"><highlight class="normal">}</highlight></codeline> <codeline lineno="271"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="272"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline> <codeline lineno="273" refid="arp_8c_1a9d1287b9a80c370797b2ac5c63f70e2e" refkind="member"><highlight class="normal"><ref refid="arp_8c_1a9d1287b9a80c370797b2ac5c63f70e2e" kindref="member">arp_query</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr<sp/>*ipaddr)</highlight></codeline> <codeline lineno="274"><highlight class="normal">{</highlight></codeline> <codeline lineno="275"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref><sp/>*hdr;</highlight></codeline> <codeline lineno="276"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline> <codeline lineno="277"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1aa4e0f27a9aca905e340c06d2dcae843c" kindref="member">uInt8</ref><sp/>i;</highlight></codeline> <codeline lineno="278"><highlight class="normal"></highlight></codeline> <codeline lineno="279"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structarp__hdr" kindref="compound">arp_hdr</ref>),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline> <codeline lineno="280"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline> <codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline> <codeline lineno="282"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="283"><highlight class="normal"></highlight></codeline> <codeline lineno="284"><highlight class="normal"><sp/><sp/>hdr<sp/>=<sp/>p-><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline> <codeline lineno="285"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="286"><highlight class="normal"><sp/><sp/>hdr->opcode<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="arp_8c_1a7a7c46ffaba30477b8c9e3e61bd2e106" kindref="member">ARP_REQUEST</ref>);</highlight></codeline> <codeline lineno="287"><highlight class="normal"></highlight></codeline> <codeline lineno="288"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>6;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr->dhwaddr.addr[i]<sp/>=<sp/>0x00;</highlight></codeline> <codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr->shwaddr.addr[i]<sp/>=<sp/>ethaddr->addr[i];</highlight></codeline> <codeline lineno="291"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="293"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(hdr->dipaddr),<sp/>ipaddr);</highlight></codeline> <codeline lineno="294"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&(hdr->sipaddr),<sp/>&(<ref refid="structnetif" kindref="compound">netif</ref>->ip_addr));</highlight></codeline> <codeline lineno="295"><highlight class="normal"></highlight></codeline> <codeline lineno="296"><highlight class="normal"><sp/><sp/>hdr->hwtype<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="arp_8c_1a28a28d3e575df3e75985e2313cc2d51a" kindref="member">HWTYPE_ETHERNET</ref>);</highlight></codeline> <codeline lineno="297"><highlight class="normal"><sp/><sp/><ref refid="arp_8c_1af463dc7a7aaf3ea0b6bc472b261380ac" kindref="member">ARPH_HWLEN_SET</ref>(hdr,<sp/>6);</highlight></codeline> <codeline lineno="298"><highlight class="normal"></highlight></codeline> <codeline lineno="299"><highlight class="normal"><sp/><sp/>hdr->proto<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline> <codeline lineno="300"><highlight class="normal"><sp/><sp/><ref refid="arp_8c_1aedb2ded9225b09da0358754f859d72d6" kindref="member">ARPH_PROTOLEN_SET</ref>(hdr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip_addr));</highlight></codeline> <codeline lineno="301"><highlight class="normal"></highlight></codeline> <codeline lineno="302"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal">(i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>6;<sp/>++i)<sp/>{</highlight></codeline> <codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr->ethhdr.dest.addr[i]<sp/>=<sp/>0xff;</highlight></codeline> <codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr->ethhdr.src.addr[i]<sp/>=<sp/>ethaddr->addr[i];</highlight></codeline> <codeline lineno="305"><highlight class="normal"><sp/><sp/>}</highlight></codeline> <codeline lineno="306"><highlight class="normal"><sp/><sp/></highlight></codeline> <codeline lineno="307"><highlight class="normal"><sp/><sp/>hdr->ethhdr.type<sp/>=<sp/><ref refid="def_8h_1a51799f5ebb4c7228ef7e95c247030f42" kindref="member">htons</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" kindref="member">ETHTYPE_ARP</ref>);<sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> <codeline lineno="308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline> <codeline lineno="309"><highlight class="normal">}</highlight></codeline> <codeline lineno="310"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline> <codeline lineno="311"><highlight class="normal"></highlight></codeline> <codeline lineno="312"><highlight class="normal"></highlight></codeline> <codeline lineno="313"><highlight class="normal"></highlight></codeline> <codeline lineno="314"><highlight class="normal"></highlight></codeline> </programlisting> <location file="C:/Dev/git/UbixOS/sys/net/netif/arp.c"/> </compounddef> </doxygen>