<?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.14">
  <compounddef id="ServerComm_8h" kind="file" language="C++">
    <compoundname>ServerComm.h</compoundname>
    <includes refid="CommBase_8h" local="no">CommBase.h</includes>
    <includes refid="DefaultComm_8h" local="no">DefaultComm.h</includes>
    <includes refid="comm__header_8h" local="no">comm_header.h</includes>
    <includedby refid="communication_8h" local="no">/root/cis_interface/cis_interface/cis_interface/communication/communication.h</includedby>
    <incdepgraph>
      <node id="250">
        <label>stdint.h</label>
        <link refid="stdint_8h_source"/>
        <childnode refid="251" relation="include">
        </childnode>
        <childnode refid="252" relation="include">
        </childnode>
      </node>
      <node id="245">
        <label>stdarg.h</label>
      </node>
      <node id="257">
        <label>../dataio/AsciiTable.h</label>
        <link refid="AsciiTable_8h_source"/>
        <childnode refid="241" relation="include">
        </childnode>
        <childnode refid="258" relation="include">
        </childnode>
      </node>
      <node id="244">
        <label>stdlib.h</label>
      </node>
      <node id="246">
        <label>errno.h</label>
      </node>
      <node id="252">
        <label>stddef.h</label>
      </node>
      <node id="241">
        <label>../tools.h</label>
        <link refid="tools_8h_source"/>
        <childnode refid="242" relation="include">
        </childnode>
        <childnode refid="243" relation="include">
        </childnode>
        <childnode refid="244" relation="include">
        </childnode>
        <childnode refid="245" relation="include">
        </childnode>
        <childnode refid="246" relation="include">
        </childnode>
        <childnode refid="247" relation="include">
        </childnode>
        <childnode refid="248" relation="include">
        </childnode>
        <childnode refid="250" relation="include">
        </childnode>
        <childnode refid="253" relation="include">
        </childnode>
      </node>
      <node id="239">
        <label>/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h</label>
        <link refid="ServerComm_8h"/>
        <childnode refid="240" relation="include">
        </childnode>
        <childnode refid="254" relation="include">
        </childnode>
        <childnode refid="256" relation="include">
        </childnode>
      </node>
      <node id="258">
        <label>AsciiFile.h</label>
        <link refid="AsciiFile_8h_source"/>
        <childnode refid="241" relation="include">
        </childnode>
      </node>
      <node id="256">
        <label>comm_header.h</label>
        <link refid="comm__header_8h_source"/>
        <childnode refid="241" relation="include">
        </childnode>
        <childnode refid="257" relation="include">
        </childnode>
      </node>
      <node id="251">
        <label>wchar.h</label>
      </node>
      <node id="242">
        <label>string.h</label>
      </node>
      <node id="240">
        <label>CommBase.h</label>
        <link refid="CommBase_8h_source"/>
        <childnode refid="241" relation="include">
        </childnode>
      </node>
      <node id="253">
        <label>unistd.h</label>
      </node>
      <node id="255">
        <label>ZMQComm.h</label>
        <link refid="ZMQComm_8h_source"/>
        <childnode refid="240" relation="include">
        </childnode>
        <childnode refid="256" relation="include">
        </childnode>
      </node>
      <node id="254">
        <label>DefaultComm.h</label>
        <link refid="DefaultComm_8h_source"/>
        <childnode refid="240" relation="include">
        </childnode>
        <childnode refid="255" relation="include">
        </childnode>
      </node>
      <node id="248">
        <label>regex_posix.h</label>
        <link refid="regex__posix_8h_source"/>
        <childnode refid="249" relation="include">
        </childnode>
        <childnode refid="250" relation="include">
        </childnode>
      </node>
      <node id="247">
        <label>time.h</label>
      </node>
      <node id="249">
        <label>regex.h</label>
      </node>
      <node id="243">
        <label>stdio.h</label>
      </node>
    </incdepgraph>
    <invincdepgraph>
      <node id="263">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/PsiInterface.hpp</label>
        <link refid="PsiInterface_8hpp_source"/>
      </node>
      <node id="259">
        <label>/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h</label>
        <link refid="ServerComm_8h"/>
        <childnode refid="260" relation="include">
        </childnode>
      </node>
      <node id="261">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/CisInterface.h</label>
        <link refid="CisInterface_8h_source"/>
        <childnode refid="262" relation="include">
        </childnode>
        <childnode refid="264" relation="include">
        </childnode>
      </node>
      <node id="264">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/PsiInterface.h</label>
        <link refid="PsiInterface_8h_source"/>
      </node>
      <node id="262">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/CisInterface.hpp</label>
        <link refid="CisInterface_8hpp_source"/>
        <childnode refid="263" relation="include">
        </childnode>
      </node>
      <node id="260">
        <label>/root/cis_interface/cis_interface/cis_interface/communication/communication.h</label>
        <link refid="communication_8h_source"/>
        <childnode refid="261" relation="include">
        </childnode>
        <childnode refid="264" relation="include">
        </childnode>
      </node>
    </invincdepgraph>
      <sectiondef kind="func">
      <memberdef kind="function" id="ServerComm_8h_1ae8a194b26810a0be0814457d73fcfcad" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int new_server_address</definition>
        <argsstring>(comm_t *comm)</argsstring>
        <name>new_server_address</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>comm</declname>
        </param>
        <briefdescription>
<para>Flag for checking if this header has already been included. </para>        </briefdescription>
        <detaileddescription>
<para>Create a new channel. <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">comm</parametername>
</parameternamelist>
<parameterdescription>
<para><ref refid="structcomm__t" kindref="compound">comm_t</ref> * Comm structure initialized with new_comm_base. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if the address could not be created. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="22" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="22" bodyend="25"/>
      </memberdef>
      <memberdef kind="function" id="ServerComm_8h_1af3c91bb6e30e902ad47a47f678e82e11" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int init_server_comm</definition>
        <argsstring>(comm_t *comm)</argsstring>
        <name>init_server_comm</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>comm</declname>
        </param>
        <briefdescription>
<para>Initialize a server communicator. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">comm</parametername>
</parameternamelist>
<parameterdescription>
<para><ref refid="structcomm__t" kindref="compound">comm_t</ref> * Comm structure initialized with init_comm_base. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if the comm could not be initialized. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="33" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="33" bodyend="74"/>
      </memberdef>
      <memberdef kind="function" id="ServerComm_8h_1a69fd089f6daaac05b85a31976ffc1d94" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int free_server_comm</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>free_server_comm</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Perform deallocation for server communicator. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">x</parametername>
</parameternamelist>
<parameterdescription>
<para>comm_t* Pointer to communicator to deallocate. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 1 if there is and error, 0 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="82" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="82" bodyend="101"/>
      </memberdef>
      <memberdef kind="function" id="ServerComm_8h_1a8dceab296ac02db5a56238aeaa22a55d" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int server_comm_nmsg</definition>
        <argsstring>(const comm_t x)</argsstring>
        <name>server_comm_nmsg</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Get number of messages in the comm. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">x</parametername>
</parameternamelist>
<parameterdescription>
<para><ref refid="structcomm__t" kindref="compound">comm_t</ref> Communicator to check. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int Number of messages. -1 indicates an error. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="109" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="109" bodyend="113"/>
      </memberdef>
      <memberdef kind="function" id="ServerComm_8h_1ad5f53dc25381f4583caec6ceff6abb9b" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int server_comm_send</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>server_comm_send</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>data</declname>
        </param>
        <param>
          <type>const size_t</type>
          <declname>len</declname>
        </param>
        <briefdescription>
<para>Send a message to the comm. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">x</parametername>
</parameternamelist>
<parameterdescription>
<para><ref refid="structcomm__t" kindref="compound">comm_t</ref> structure that comm should be sent to. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">data</parametername>
</parameternamelist>
<parameterdescription>
<para>character pointer to message that should be sent. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t length of message to be sent. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 0 if send succesfull, -1 if send unsuccessful. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="123" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="123" bodyend="141"/>
      </memberdef>
      <memberdef kind="function" id="ServerComm_8h_1ada824b10d081875a570d0eddd439cfc0" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int server_comm_recv</definition>
        <argsstring>(comm_t x, char **data, const size_t len, const int allow_realloc)</argsstring>
        <name>server_comm_recv</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <param>
          <type>char **</type>
          <declname>data</declname>
        </param>
        <param>
          <type>const size_t</type>
          <declname>len</declname>
        </param>
        <param>
          <type>const int</type>
          <declname>allow_realloc</declname>
        </param>
        <briefdescription>
<para>Receive a message from an input comm. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">x</parametername>
</parameternamelist>
<parameterdescription>
<para><ref refid="structcomm__t" kindref="compound">comm_t</ref> structure that message should be sent to. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="out">data</parametername>
</parameternamelist>
<parameterdescription>
<para>char ** pointer to allocated buffer where the message should be saved. This should be a malloc&apos;d buffer if allow_realloc is 1. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>const size_t length of the allocated message buffer in bytes. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">allow_realloc</parametername>
</parameternamelist>
<parameterdescription>
<para>const int If 1, the buffer will be realloced if it is not large enought. Otherwise an error will be returned. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if message could not be received. Length of the received message if message was received. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" line="155" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h" bodystart="155" bodyend="207"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="2"><highlight class="preprocessor">#ifndef<sp/>CISSERVERCOMM_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>CISSERVERCOMM_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;CommBase.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;DefaultComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;comm_header.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>__cplusplus<sp/></highlight><highlight class="comment">/*<sp/>If<sp/>this<sp/>is<sp/>a<sp/>C++<sp/>compiler,<sp/>use<sp/>C<sp/>linkage<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keyword">extern</highlight><highlight class="normal"><sp/></highlight><highlight class="stringliteral">&quot;C&quot;</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Handle<sp/>is<sp/>recv<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Info<sp/>is<sp/>response</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>new_server_address(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*comm)<sp/>{</highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>=<sp/>_default_comm;</highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>new_default_address(comm);</highlight></codeline>
<codeline lineno="25"><highlight class="normal">};</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>init_server_comm(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*comm)<sp/>{</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="35"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Called<sp/>to<sp/>create<sp/>temp<sp/>comm<sp/>for<sp/>send/recv</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((strlen(comm-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>)<sp/>==<sp/>0)<sp/>&amp;&amp;<sp/>(strlen(comm-&gt;<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>)<sp/>&gt;<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="37"><highlight class="normal"><sp/><sp/><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>=<sp/>_default_comm;</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>init_default_comm(comm);</highlight></codeline>
<codeline lineno="39"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Called<sp/>to<sp/>initialize/create<sp/>server<sp/>comm</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*seri_in<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)malloc(strlen(comm-&gt;<ref refid="structcomm__t_1a1940bbad161f8cf5f868ff4cf4e95cda" kindref="member">direction</ref>)<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(seri_in<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_server_comm:<sp/>Failed<sp/>to<sp/>malloc<sp/>seri_in.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/>strcpy(seri_in,<sp/>comm-&gt;<ref refid="structcomm__t_1a1940bbad161f8cf5f868ff4cf4e95cda" kindref="member">direction</ref>);</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>printf(&quot;init_server_comm(%s):<sp/>seri:<sp/>%s\n&quot;,<sp/>comm-&gt;name,<sp/>seri_in);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*handle;</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(strlen(comm-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/>handle<sp/>=<sp/>new_comm_base(comm-&gt;<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>,<sp/></highlight><highlight class="stringliteral">&quot;recv&quot;</highlight><highlight class="normal">,<sp/>_default_comm,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)seri_in);</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/>sprintf(handle-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/></highlight><highlight class="stringliteral">&quot;server_request.%s&quot;</highlight><highlight class="normal">,<sp/>comm-&gt;<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>);</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/>handle<sp/>=<sp/>init_comm_base(comm-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/></highlight><highlight class="stringliteral">&quot;recv&quot;</highlight><highlight class="normal">,<sp/>_default_comm,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)seri_in);</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>init_default_comm(handle);</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/>strcpy(comm-&gt;<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>,<sp/>handle-&gt;<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>);</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>printf(&quot;init_server_comm:<sp/>name<sp/>=<sp/>%s,<sp/>type=%d,<sp/>address<sp/>=<sp/>%s\n&quot;,</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/>handle-&gt;name,<sp/>handle-&gt;type,<sp/>handle-&gt;address);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/>strcpy(comm-&gt;<ref refid="structcomm__t_1a1940bbad161f8cf5f868ff4cf4e95cda" kindref="member">direction</ref>,<sp/></highlight><highlight class="stringliteral">&quot;recv&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)handle;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(_default_comm<sp/>==<sp/>ZMQ_COMM)<sp/>{</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1a9810578a787d8503b00bcb78a592073d" kindref="member">always_send_header</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1a9810578a787d8503b00bcb78a592073d" kindref="member">always_send_header</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="66"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>**info<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>**)malloc(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(<ref refid="structcomm__t" kindref="compound">comm_t</ref>*));</highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(info<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_server_comm:<sp/>Failed<sp/>to<sp/>malloc<sp/>info.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/>info[0]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/>comm-&gt;<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)info;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="74"><highlight class="normal">};</highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>free_server_comm(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x-&gt;<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref><sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*handle<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>*)(x-&gt;<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/>free_default_comm(handle);</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/>free_comm_base(handle);</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/>free(x-&gt;<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/>x-&gt;<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref><sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x-&gt;<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref><sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>**info<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>**)(x-&gt;<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*info<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_default_comm(*info);</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm_base(*info);</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(*info);</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/>free(info);</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/>x-&gt;<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref><sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="101"><highlight class="normal">};</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>server_comm_nmsg(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x)<sp/>{</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*handle<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>*)(x.<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>default_comm_nmsg(*handle);</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="113"><highlight class="normal">};</highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>server_comm_send(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*data,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>len)<sp/>{</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;server_comm_send(%s):<sp/>%d<sp/>bytes&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>len);</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref><sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_send(%s):<sp/>no<sp/>response<sp/>comm<sp/>registered&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>**res_comm<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>**)(x.<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(res_comm[0]<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_send(%s):<sp/>no<sp/>response<sp/>comm<sp/>registered&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>default_comm_send((*res_comm)[0],<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Wait<sp/>for<sp/>msg<sp/>to<sp/>be<sp/>received?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/>free_default_comm(res_comm[0]);</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/>free_comm_base(res_comm[0]);</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/>free(res_comm[0]);</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/>res_comm[0]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="141"><highlight class="normal">};</highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>server_comm_recv(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x,<sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>**data,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>len,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>allow_realloc)<sp/>{</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s)&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref><sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s):<sp/>no<sp/>request<sp/>comm<sp/>registered&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*req_comm<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>*)(x.<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>default_comm_recv(*req_comm,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Return<sp/>EOF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof(*data))<sp/>{</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/>req_comm-&gt;<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialize<sp/>new<sp/>comm<sp/>from<sp/>received<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref><sp/>head<sp/>=<sp/>parse_comm_header(*data,<sp/>ret);</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!(head.<ref refid="structcomm__head__t_1a541f991a66b2422bec7b1cc25b5dd567" kindref="member">valid</ref>))<sp/>{</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s):<sp/>Error<sp/>parsing<sp/>header.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Return<sp/>EOF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof((*data)<sp/>+<sp/>head.<ref refid="structcomm__head__t_1a5e01ad7e302f5597bccfcf208cdcbe0a" kindref="member">bodybeg</ref>))<sp/>{</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/>req_comm-&gt;<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>there<sp/>is<sp/>not<sp/>a<sp/>response<sp/>address</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(strlen(head.<ref refid="structcomm__head__t_1a5a1970e9fb2c1087c001345603ab5c2b" kindref="member">response_address</ref>)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s):<sp/>No<sp/>response<sp/>address<sp/>in<sp/>message.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/>strcpy(x.<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>,<sp/>head.<ref refid="structcomm__head__t_1ade03bb53d07aaffff906db9a8d95da02" kindref="member">id</ref>);</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*seri_copy<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)malloc(strlen((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)(x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>))<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(seri_copy<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s):<sp/>Failed<sp/>to<sp/>malloc<sp/>seri_copy.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/>strcpy(seri_copy,<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)(x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>));</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>**res_comm<sp/>=<sp/>(<ref refid="structcomm__t" kindref="compound">comm_t</ref>**)(x.<ref refid="structcomm__t_1ac805f6f060d8a6d7be78e9e782d15fdd" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/>res_comm[0]<sp/>=<sp/>new_comm_base(head.<ref refid="structcomm__head__t_1a5a1970e9fb2c1087c001345603ab5c2b" kindref="member">response_address</ref>,<sp/></highlight><highlight class="stringliteral">&quot;send&quot;</highlight><highlight class="normal">,<sp/>_default_comm,</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>seri_copy);</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>sprintf(res_comm[0]-&gt;name,<sp/>&quot;server_response.%s&quot;,<sp/>res_comm[0]-&gt;address);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>newret;</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/>newret<sp/>=<sp/>init_default_comm(res_comm[0]);</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;server_comm_recv(%s):<sp/>Could<sp/>not<sp/>initialize<sp/>response<sp/>comm.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>newret;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/>res_comm[0]-&gt;<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/>res_comm[0]-&gt;<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="207"><highlight class="normal">};</highlight></codeline>
<codeline lineno="208"><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>__cplusplus<sp/></highlight><highlight class="comment">/*<sp/>If<sp/>this<sp/>is<sp/>a<sp/>C++<sp/>compiler,<sp/>end<sp/>C<sp/>linkage<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal">}</highlight></codeline>
<codeline lineno="211"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*CISSERVERCOMM_H_*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="/root/cis_interface/cis_interface/cis_interface/communication/ServerComm.h"/>
  </compounddef>
</doxygen>
