<?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="net_8c" kind="file" language="C++">
    <compoundname>net.c</compoundname>
    <includes refid="include_2sys_2types_8h" local="no">sys/types.h</includes>
    <includes refid="inet_8h" local="no">net/inet.h</includes>
    <includes refid="sockets_8h" local="no">net/sockets.h</includes>
    <includes refid="string_8h" local="no">string.h</includes>
    <includes refid="kprintf_8h" local="yes">lib/kprintf.h</includes>
    <incdepgraph>
      <node id="18">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="19">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="16">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="26">
        <label>strings.h</label>
        <link refid="strings_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </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="9">
        <label>net/inet.h</label>
        <link refid="inet_8h"/>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="14">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="15" 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="11">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="25">
        <label>string.h</label>
        <link refid="string_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
      </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="24">
        <label>net/sockets.h</label>
        <link refid="sockets_8h"/>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="20">
        <label>net/def.h</label>
        <link refid="def_8h"/>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
      </node>
      <node id="23">
        <label>net/ip6_addr.h</label>
        <link refid="ip6__addr_8h"/>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="17">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="22">
        <label>net/ip4_addr.h</label>
        <link refid="ip4__addr_8h"/>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>net/ip_addr.h</label>
        <link refid="ip__addr_8h"/>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="15">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </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>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/lib/net.c</label>
        <link refid="net_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="net_8c_1aa80095a7cbb28b03d56d20117e7a0c05" prot="public" static="no">
        <name>_IN_ADDR_T_DECLARED</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/lib/net.c" line="38" column="9" bodyfile="C:/Dev/git/UbixOS/sys/lib/net.c" bodystart="38" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="typedef">
      <memberdef kind="typedef" id="net_8c_1a8713edfd5a984843afe38b50d22c50a5" prot="public" static="no">
        <type><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref></type>
        <definition>typedef uInt32 in_addr_t</definition>
        <argsstring></argsstring>
        <name>in_addr_t</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/lib/net.c" line="37" column="16" bodyfile="C:/Dev/git/UbixOS/sys/lib/net.c" bodystart="37" bodyend="-1"/>
      </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/>2002-2018<sp/>The<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>This<sp/>was<sp/>developed<sp/>by<sp/>Christopher<sp/>W.<sp/>Olsen<sp/>for<sp/>the<sp/>UbixOS<sp/>Project.</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="7"><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/>modification,<sp/>are<sp/>permitted</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><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/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors.</highlight></codeline>
<codeline lineno="12"><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/>notice,<sp/>this<sp/>list<sp/>of</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>conditions,<sp/>the<sp/>following<sp/>disclaimer<sp/>and<sp/>the<sp/>list<sp/>of<sp/>authors<sp/>in<sp/>the<sp/>documentation<sp/>and/or</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>3)<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>the<sp/>UbixOS<sp/>Project<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors<sp/>may<sp/>be<sp/>used<sp/>to</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>permission.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>AND<sp/>CONTRIBUTORS<sp/>&quot;AS<sp/>IS&quot;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>COPYRIGHT<sp/>OWNER<sp/>OR<sp/>CONTRIBUTORS</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<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/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="include_2sys_2types_8h" kindref="compound">sys/types.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="inet_8h" kindref="compound">net/inet.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="sockets_8h" kindref="compound">net/sockets.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="kprintf_8h" kindref="compound">lib/kprintf.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>_IN_ADDR_T_DECLARED</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37" refid="net_8c_1a8713edfd5a984843afe38b50d22c50a5" refkind="member"><highlight class="normal"></highlight><highlight class="keyword">typedef</highlight><highlight class="normal"><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/><ref refid="net_8c_1a8713edfd5a984843afe38b50d22c50a5" kindref="member">in_addr_t</ref>;</highlight></codeline>
<codeline lineno="38" refid="net_8c_1aa80095a7cbb28b03d56d20117e7a0c05" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>_IN_ADDR_T_DECLARED</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>uInt32<sp/>htonl(uInt32<sp/>n)<sp/>{</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>uInt32<sp/>retVal<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>retVal<sp/>+=<sp/>((n<sp/>&amp;<sp/>0xff)<sp/>&lt;&lt;<sp/>24);</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>retVal<sp/>+=<sp/>((n<sp/>&amp;<sp/>0xff00)<sp/>&lt;&lt;<sp/>8);</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/>retVal<sp/>+=<sp/>((n<sp/>&amp;<sp/>0xff0000)<sp/>&gt;&gt;<sp/>8);</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/>retVal<sp/>+=<sp/>((n<sp/>&amp;<sp/>0xff000000)<sp/>&gt;&gt;<sp/>24);</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/>return(retVal);</highlight></codeline>
<codeline lineno="49"><highlight class="comment"><sp/>}</highlight></codeline>
<codeline lineno="50"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>uInt32<sp/>htons(uInt32<sp/>n)<sp/>{</highlight></codeline>
<codeline lineno="54"><highlight class="comment"><sp/>uInt32<sp/>retVal<sp/>=<sp/>0x0;</highlight></codeline>
<codeline lineno="55"><highlight class="comment"><sp/>retVal<sp/>=<sp/>(((n<sp/>&amp;<sp/>0xff)<sp/>&lt;&lt;<sp/>8)<sp/>|<sp/>((n<sp/>&amp;<sp/>0xff00)<sp/>&gt;&gt;<sp/>8));</highlight></codeline>
<codeline lineno="56"><highlight class="comment"><sp/>return(retVal);</highlight></codeline>
<codeline lineno="57"><highlight class="comment"><sp/>}</highlight></codeline>
<codeline lineno="58"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>_INET_ATON</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>inet_aton(cp,<sp/>addr)</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*cp;</highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structin__addr" kindref="compound">in_addr</ref><sp/>*addr;</highlight></codeline>
<codeline lineno="65"><highlight class="normal">{</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><ref refid="objgfx30_8h_1ada085051a6d9a8e00a2cb256d1af14ba" kindref="member">uInt32</ref><sp/>parts[4];</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><ref refid="inet_8h_1ab4fa3cac7cd90edc5ceb4efca7ec0059" kindref="member">in_addr_t</ref><sp/>val;</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*c;</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*endptr;</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>gotend,<sp/>n;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/>c<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*)cp;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/>n<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="75"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Run<sp/>through<sp/>the<sp/>string,<sp/>grabbing<sp/>numbers<sp/>until</highlight></codeline>
<codeline lineno="76"><highlight class="comment"><sp/><sp/><sp/>*<sp/>the<sp/>end<sp/>of<sp/>the<sp/>string,<sp/>or<sp/>some<sp/>error</highlight></codeline>
<codeline lineno="77"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/>gotend<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(!gotend)<sp/>{</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//errno<sp/>=<sp/>0;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/>val<sp/>=<sp/><ref refid="strtol_8c_1a23a80e470a9dae66d16e7d25fbba122a" kindref="member">strtol</ref>(c,<sp/>&amp;endptr,<sp/>0);</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="kprintf_8h_1a20b56810edb62a6fe59917015c30848f" kindref="member">kprintf</ref>(</highlight><highlight class="stringliteral">&quot;VAL:<sp/>[%x]&quot;</highlight><highlight class="normal">,val);</highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//if<sp/>(errno<sp/>==<sp/>ERANGE)<sp/><sp/><sp/><sp/>/*<sp/>Fail<sp/>completely<sp/>if<sp/>it<sp/>overflowed.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>(0);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="88"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>If<sp/>the<sp/>whole<sp/>string<sp/>is<sp/>invalid,<sp/>endptr<sp/>will<sp/>equal</highlight></codeline>
<codeline lineno="89"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>c..<sp/>this<sp/>way<sp/>we<sp/>can<sp/>make<sp/>sure<sp/>someone<sp/>hasn&apos;t</highlight></codeline>
<codeline lineno="90"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>gone<sp/>&apos;.12&apos;<sp/>or<sp/>something<sp/>which<sp/>would<sp/>get<sp/>past</highlight></codeline>
<codeline lineno="91"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>the<sp/>next<sp/>check.</highlight></codeline>
<codeline lineno="92"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(endptr<sp/>==<sp/>c)</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/>parts[n]<sp/>=<sp/>val;</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/>c<sp/>=<sp/>endptr;</highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>the<sp/>next<sp/>character<sp/>past<sp/>the<sp/>previous<sp/>number&apos;s<sp/>end<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(*c)<sp/>{</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal"><sp/>:</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Make<sp/>sure<sp/>we<sp/>only<sp/>do<sp/>3<sp/>dots<sp/>..<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n<sp/>==<sp/>3)<sp/></highlight><highlight class="comment">/*<sp/>Whoops.<sp/>Quit.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>n++;</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>c++;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>gotend<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="114"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>if<sp/>(isspace((unsigned<sp/>char)*c))<sp/>{</highlight></codeline>
<codeline lineno="115"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>gotend<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="116"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>break;</highlight></codeline>
<codeline lineno="117"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/>else</highlight></codeline>
<codeline lineno="118"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);<sp/></highlight><highlight class="comment">/*<sp/>Invalid<sp/>character,<sp/>so<sp/>fail<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="125"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Concoct<sp/>the<sp/>address<sp/>according<sp/>to</highlight></codeline>
<codeline lineno="126"><highlight class="comment"><sp/><sp/><sp/>*<sp/>the<sp/>number<sp/>of<sp/>parts<sp/>specified.</highlight></codeline>
<codeline lineno="127"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(n)<sp/>{</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>0:<sp/></highlight><highlight class="comment">/*<sp/>a<sp/>--<sp/>32<sp/>bits<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="132"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>Nothing<sp/>is<sp/>necessary<sp/>here.<sp/><sp/>Overflow<sp/>checking<sp/>was</highlight></codeline>
<codeline lineno="133"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>already<sp/>done<sp/>in<sp/>strtoul().</highlight></codeline>
<codeline lineno="134"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>1:<sp/></highlight><highlight class="comment">/*<sp/>a.b<sp/>--<sp/>8.24<sp/>bits<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(val<sp/>&gt;<sp/>0xffffff<sp/>||<sp/>parts[0]<sp/>&gt;<sp/>0xff)</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/>val<sp/>|=<sp/>parts[0]<sp/>&lt;&lt;<sp/>24;</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>2:<sp/></highlight><highlight class="comment">/*<sp/>a.b.c<sp/>--<sp/>8.8.16<sp/>bits<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(val<sp/>&gt;<sp/>0xffff<sp/>||<sp/>parts[0]<sp/>&gt;<sp/>0xff<sp/>||<sp/>parts[1]<sp/>&gt;<sp/>0xff)</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/>val<sp/>|=<sp/>(parts[0]<sp/>&lt;&lt;<sp/>24)<sp/>|<sp/>(parts[1]<sp/>&lt;&lt;<sp/>16);</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>3:<sp/></highlight><highlight class="comment">/*<sp/>a.b.c.d<sp/>--<sp/>8.8.8.8<sp/>bits<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(val<sp/>&gt;<sp/>0xff<sp/>||<sp/>parts[0]<sp/>&gt;<sp/>0xff<sp/>||<sp/>parts[1]<sp/>&gt;<sp/>0xff<sp/>||</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>parts[2]<sp/>&gt;<sp/>0xff)</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(0);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/>val<sp/>|=<sp/>(parts[0]<sp/>&lt;&lt;<sp/>24)<sp/>|<sp/>(parts[1]<sp/>&lt;&lt;<sp/>16)<sp/>|<sp/>(parts[2]<sp/>&lt;&lt;<sp/>8);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/>addr-&gt;<ref refid="structin__addr_1a3b6ef12385f913cc23a199205d9bf858" kindref="member">s_addr</ref><sp/>=<sp/><ref refid="def_8h_1ae4027a6ad07f13aa12eab285a1b46019" kindref="member">htonl</ref>(val);</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(1);</highlight></codeline>
<codeline lineno="159"><highlight class="normal">}</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight><highlight class="comment">/***</highlight></codeline>
<codeline lineno="163"><highlight class="comment"><sp/>END</highlight></codeline>
<codeline lineno="164"><highlight class="comment"><sp/>***/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/lib/net.c"/>
  </compounddef>
</doxygen>
