<?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="communication_8h" kind="file" language="C++">
    <compoundname>communication.h</compoundname>
    <includes refid="tools_8h" local="no">../tools.h</includes>
    <includes refid="serialize_8h" local="no">../serialize/serialize.h</includes>
    <includes refid="comm__header_8h" local="no">comm_header.h</includes>
    <includes refid="CommBase_8h" local="no">CommBase.h</includes>
    <includes refid="IPCComm_8h" local="no">IPCComm.h</includes>
    <includes refid="ZMQComm_8h" local="no">ZMQComm.h</includes>
    <includes refid="RPCComm_8h" local="no">RPCComm.h</includes>
    <includes refid="ServerComm_8h" local="no">ServerComm.h</includes>
    <includes refid="ClientComm_8h" local="no">ClientComm.h</includes>
    <includes refid="AsciiFileComm_8h" local="no">AsciiFileComm.h</includes>
    <includes refid="AsciiTableComm_8h" local="no">AsciiTableComm.h</includes>
    <includes refid="DefaultComm_8h" local="no">DefaultComm.h</includes>
    <includedby refid="CisInterface_8h" local="no">/root/cis_interface/cis_interface/cis_interface/interface/CisInterface.h</includedby>
    <includedby refid="PsiInterface_8h" local="no">/root/cis_interface/cis_interface/cis_interface/interface/PsiInterface.h</includedby>
    <incdepgraph>
      <node id="137">
        <label>stdint.h</label>
        <link refid="stdint_8h_source"/>
        <childnode refid="138" relation="include">
        </childnode>
        <childnode refid="139" relation="include">
        </childnode>
      </node>
      <node id="158">
        <label>AsciiTableComm.h</label>
        <link refid="AsciiTableComm_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="144" relation="include">
        </childnode>
      </node>
      <node id="132">
        <label>stdarg.h</label>
      </node>
      <node id="144">
        <label>../dataio/AsciiTable.h</label>
        <link refid="AsciiTable_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="145" relation="include">
        </childnode>
      </node>
      <node id="131">
        <label>stdlib.h</label>
      </node>
      <node id="133">
        <label>errno.h</label>
      </node>
      <node id="157">
        <label>AsciiFileComm.h</label>
        <link refid="AsciiFileComm_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="145" relation="include">
        </childnode>
        <childnode refid="144" relation="include">
        </childnode>
      </node>
      <node id="146">
        <label>AsciiTableSerialize.h</label>
        <link refid="AsciiTableSerialize_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="142" relation="include">
        </childnode>
        <childnode refid="144" relation="include">
        </childnode>
      </node>
      <node id="148">
        <label>ObjSerialize.h</label>
        <link refid="ObjSerialize_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
      </node>
      <node id="139">
        <label>stddef.h</label>
      </node>
      <node id="128">
        <label>../tools.h</label>
        <link refid="tools_8h_source"/>
        <childnode refid="129" relation="include">
        </childnode>
        <childnode refid="130" relation="include">
        </childnode>
        <childnode refid="131" relation="include">
        </childnode>
        <childnode refid="132" relation="include">
        </childnode>
        <childnode refid="133" relation="include">
        </childnode>
        <childnode refid="134" relation="include">
        </childnode>
        <childnode refid="135" relation="include">
        </childnode>
        <childnode refid="137" relation="include">
        </childnode>
        <childnode refid="140" relation="include">
        </childnode>
      </node>
      <node id="151">
        <label>IPCComm.h</label>
        <link refid="IPCComm_8h_source"/>
        <childnode refid="150" relation="include">
        </childnode>
      </node>
      <node id="143">
        <label>FormatSerialize.h</label>
        <link refid="FormatSerialize_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="142" relation="include">
        </childnode>
        <childnode refid="144" relation="include">
        </childnode>
      </node>
      <node id="155">
        <label>ServerComm.h</label>
        <link refid="ServerComm_8h_source"/>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="154" relation="include">
        </childnode>
        <childnode refid="149" relation="include">
        </childnode>
      </node>
      <node id="141">
        <label>../serialize/serialize.h</label>
        <link refid="serialize_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="142" relation="include">
        </childnode>
        <childnode refid="143" relation="include">
        </childnode>
        <childnode refid="146" relation="include">
        </childnode>
        <childnode refid="147" relation="include">
        </childnode>
        <childnode refid="148" relation="include">
        </childnode>
      </node>
      <node id="145">
        <label>AsciiFile.h</label>
        <link refid="AsciiFile_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
      </node>
      <node id="147">
        <label>PlySerialize.h</label>
        <link refid="PlySerialize_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
      </node>
      <node id="149">
        <label>comm_header.h</label>
        <link refid="comm__header_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="144" relation="include">
        </childnode>
      </node>
      <node id="138">
        <label>wchar.h</label>
      </node>
      <node id="129">
        <label>string.h</label>
      </node>
      <node id="150">
        <label>CommBase.h</label>
        <link refid="CommBase_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
      </node>
      <node id="153">
        <label>RPCComm.h</label>
        <link refid="RPCComm_8h_source"/>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="154" relation="include">
        </childnode>
        <childnode refid="149" relation="include">
        </childnode>
      </node>
      <node id="140">
        <label>unistd.h</label>
      </node>
      <node id="152">
        <label>ZMQComm.h</label>
        <link refid="ZMQComm_8h_source"/>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="149" relation="include">
        </childnode>
      </node>
      <node id="154">
        <label>DefaultComm.h</label>
        <link refid="DefaultComm_8h_source"/>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="152" relation="include">
        </childnode>
      </node>
      <node id="135">
        <label>regex_posix.h</label>
        <link refid="regex__posix_8h_source"/>
        <childnode refid="136" relation="include">
        </childnode>
        <childnode refid="137" relation="include">
        </childnode>
      </node>
      <node id="134">
        <label>time.h</label>
      </node>
      <node id="142">
        <label>SerializeBase.h</label>
        <link refid="SerializeBase_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
      </node>
      <node id="156">
        <label>ClientComm.h</label>
        <link refid="ClientComm_8h_source"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="154" relation="include">
        </childnode>
        <childnode refid="149" relation="include">
        </childnode>
      </node>
      <node id="127">
        <label>/root/cis_interface/cis_interface/cis_interface/communication/communication.h</label>
        <link refid="communication_8h"/>
        <childnode refid="128" relation="include">
        </childnode>
        <childnode refid="141" relation="include">
        </childnode>
        <childnode refid="149" relation="include">
        </childnode>
        <childnode refid="150" relation="include">
        </childnode>
        <childnode refid="151" relation="include">
        </childnode>
        <childnode refid="152" relation="include">
        </childnode>
        <childnode refid="153" relation="include">
        </childnode>
        <childnode refid="155" relation="include">
        </childnode>
        <childnode refid="156" relation="include">
        </childnode>
        <childnode refid="157" relation="include">
        </childnode>
        <childnode refid="158" relation="include">
        </childnode>
        <childnode refid="154" relation="include">
        </childnode>
      </node>
      <node id="136">
        <label>regex.h</label>
      </node>
      <node id="130">
        <label>stdio.h</label>
      </node>
    </incdepgraph>
    <invincdepgraph>
      <node id="162">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/PsiInterface.hpp</label>
        <link refid="PsiInterface_8hpp_source"/>
      </node>
      <node id="160">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/CisInterface.h</label>
        <link refid="CisInterface_8h_source"/>
        <childnode refid="161" relation="include">
        </childnode>
        <childnode refid="163" relation="include">
        </childnode>
      </node>
      <node id="163">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/PsiInterface.h</label>
        <link refid="PsiInterface_8h_source"/>
      </node>
      <node id="161">
        <label>/root/cis_interface/cis_interface/cis_interface/interface/CisInterface.hpp</label>
        <link refid="CisInterface_8hpp_source"/>
        <childnode refid="162" relation="include">
        </childnode>
      </node>
      <node id="159">
        <label>/root/cis_interface/cis_interface/cis_interface/communication/communication.h</label>
        <link refid="communication_8h"/>
        <childnode refid="160" relation="include">
        </childnode>
        <childnode refid="163" relation="include">
        </childnode>
      </node>
    </invincdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="communication_8h_1ae2a3242094495fc8b9233370c632f54a" prot="public" static="no">
        <name>vcommSend_nolimit</name>
        <initializer>vcommSend</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="1050" column="9" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="1050" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="communication_8h_1af1de87c0c0e90766202604d39c615204" prot="public" static="no">
        <name>vcommRecv_nolimit</name>
        <initializer>vcommRecv</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="1051" column="9" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="1051" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="var">
      <memberdef kind="variable" id="communication_8h_1a23f0f8d1dec86c00fc62312cedec210a" prot="public" static="yes" mutable="no">
        <type>void **</type>
        <definition>void** vcomms2clean</definition>
        <argsstring></argsstring>
        <name>vcomms2clean</name>
        <initializer>= NULL</initializer>
        <briefdescription>
<para>Flag for checking if this header has already been included. </para>        </briefdescription>
        <detaileddescription>
<para>Memory to keep track of comms to clean up at exit. </para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="23" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="23" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="communication_8h_1ace8233153e40fed0873727486b7eaa94" prot="public" static="yes" mutable="no">
        <type>size_t</type>
        <definition>size_t ncomms2clean</definition>
        <argsstring></argsstring>
        <name>ncomms2clean</name>
        <initializer>= 0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="24" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="24" bodyend="-1"/>
      </memberdef>
      <memberdef kind="variable" id="communication_8h_1acb4fb5c8117784dc0b16b01dfaf86a9c" prot="public" static="yes" mutable="no">
        <type>size_t</type>
        <definition>size_t clean_registered</definition>
        <argsstring></argsstring>
        <name>clean_registered</name>
        <initializer>= 0</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="25" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="25" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="communication_8h_1a0695d967bb98fa15fae1cc984a42875c" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send_eof</definition>
        <argsstring>(const comm_t x)</argsstring>
        <name>comm_send_eof</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Send EOF 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 message should be sent to. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 0 if send successfull, -1 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="29" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="638" bodyend="643"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a5a2913cd2c6eececda1766efa727bf22" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_nmsg</definition>
        <argsstring>(const comm_t x)</argsstring>
        <name>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. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="31" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="304" bodyend="329"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1aa348f379630a703daed105707903b0ed" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int free_comm_type</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>free_comm_type</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Perform deallocation for type specific communicator. </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> * Pointer to communicator to deallocate. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 1 if there is an error, 0 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="40" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="40" bodyend="61"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a7215ffe6aadcdf9144c91abe31826d3c" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int free_comm</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>free_comm</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Perform deallocation for generic communicator. </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> * Pointer to communicator to deallocate. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 1 if there is an error, 0 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="69" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="69" bodyend="98"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1aeb63625d238d1d6f04a25ea1eedafbbc" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void clean_comms</definition>
        <argsstring>(void)</argsstring>
        <name>clean_comms</name>
        <param>
          <type>void</type>
        </param>
        <briefdescription>
<para>Free comms created that were not freed. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="104" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="104" bodyend="123"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a9e6ee40082d8575a385f6c1c2c82f3bf" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int register_comm</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>register_comm</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Register a comm so that it can be cleaned up later if not done explicitly. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">x</parametername>
</parameternamelist>
<parameterdescription>
<para>comm_t* Address of communicator structure that should be registered. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if there is an error, 0 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="132" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="132" bodyend="149"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1aa8ed42f8e0013eb8b8e424d44dc3faeb" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int new_comm_type</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>new_comm_type</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Initialize a new communicator based on its type. </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> * Pointer to communicator structure initialized with new_base_comm; </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/communication.h" line="158" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="158" bodyend="182"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a1baa1926cc0a35121ed951f6c73fe353" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int init_comm_type</definition>
        <argsstring>(comm_t *x)</argsstring>
        <name>init_comm_type</name>
        <param>
          <type><ref refid="structcomm__t" kindref="compound">comm_t</ref> *</type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Initialize the communicator based on its type. </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> * Pointer to communicator structure initialized with init_base_comm; </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/communication.h" line="191" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="191" bodyend="216"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a13c3dd3b3add15aac9afbddf8aebbde9" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
        <definition>static comm_t new_comm</definition>
        <argsstring>(char *address, const char *direction, const comm_type t, void *seri_info)</argsstring>
        <name>new_comm</name>
        <param>
          <type>char *</type>
          <declname>address</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>direction</declname>
        </param>
        <param>
          <type>const comm_type</type>
          <declname>t</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>seri_info</declname>
        </param>
        <briefdescription>
<para>Initialize comm from the address. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">address</parametername>
</parameternamelist>
<parameterdescription>
<para>char * Address for new comm. If NULL, a new address is generated. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">direction</parametername>
</parameternamelist>
<parameterdescription>
<para>Direction that messages will go through the comm. Values include &quot;recv&quot; and &quot;send&quot;. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">t</parametername>
</parameternamelist>
<parameterdescription>
<para>comm_type Type of comm that should be created. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">seri_info</parametername>
</parameternamelist>
<parameterdescription>
<para>Pointer to info for the serializer (e.g. format string). </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para><ref refid="structcomm__t" kindref="compound">comm_t</ref> Comm structure. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="229" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="229" bodyend="256"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1ac29661078a1328619912404c269e0ebd" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
        <definition>static comm_t init_comm</definition>
        <argsstring>(const char *name, const char *direction, const comm_type t, const void *seri_info)</argsstring>
        <name>init_comm</name>
        <param>
          <type>const char *</type>
          <declname>name</declname>
        </param>
        <param>
          <type>const char *</type>
          <declname>direction</declname>
        </param>
        <param>
          <type>const comm_type</type>
          <declname>t</declname>
        </param>
        <param>
          <type>const void *</type>
          <declname>seri_info</declname>
        </param>
        <briefdescription>
<para>Initialize a generic communicator. The name is used to locate the comm address stored in the associated environment variable. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">name</parametername>
</parameternamelist>
<parameterdescription>
<para>Name of environment variable that the queue address is stored in. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">direction</parametername>
</parameternamelist>
<parameterdescription>
<para>Direction that messages will go through the comm. Values include &quot;recv&quot; and &quot;send&quot;. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">t</parametername>
</parameternamelist>
<parameterdescription>
<para>comm_type Type of comm that should be created. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">seri_info</parametername>
</parameternamelist>
<parameterdescription>
<para>Pointer to info for the serializer (e.g. format string). </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para><ref refid="structcomm__t" kindref="compound">comm_t</ref> Comm structure. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="271" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="271" bodyend="296"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a69c98e6d0ba9ac16b3c733db39eb5678" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send_single</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>comm_send_single</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 single message to the comm. Send a message smaller than CIS_MSG_MAX bytes to an output comm. If the message is larger, it will not be sent. </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/communication.h" line="341" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="341" bodyend="372"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a36ee4dd9349cf0e272868b943eed7116" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref></type>
        <definition>static comm_head_t comm_send_multipart_header</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>comm_send_multipart_header</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>Create header for multipart message. </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 header will be sent to. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">const</parametername>
</parameternamelist>
<parameterdescription>
<para>char * Message to be sent. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t Size of message body. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref> Header info that should be sent before the message body. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="384" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="384" bodyend="454"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a92f1909262fedcc3ec32cdc892446b50" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send_multipart</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>comm_send_multipart</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 large message in multiple parts via a new 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="in">data</parametername>
</parameternamelist>
<parameterdescription>
<para>const char * Message that should be sent. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t Size of data. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>: int 0 if send successfull, -1 if send unsuccessful. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="464" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="464" bodyend="578"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a95b111c3074e6c520189c844188e265f" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>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. Send a message smaller than CIS_MSG_MAX bytes to an output comm. If the message is larger, it will not be sent. </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/communication.h" line="591" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="591" bodyend="630"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a40044ddd870b23d4907aba86decaaacd" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_recv_single</definition>
        <argsstring>(const comm_t x, char **data, const size_t len, const int allow_realloc)</argsstring>
        <name>comm_recv_single</name>
        <param>
          <type>const <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. Receive a message smaller than CIS_MSG_MAX bytes 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, otherwise the length of the received message. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="658" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="658" bodyend="684"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1abcd53469eafdb197b4422de0c27816ec" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_recv_multipart</definition>
        <argsstring>(const comm_t x, char **data, const size_t len, const size_t headlen, const int allow_realloc)</argsstring>
        <name>comm_recv_multipart</name>
        <param>
          <type>const <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 size_t</type>
          <declname>headlen</declname>
        </param>
        <param>
          <type>const int</type>
          <declname>allow_realloc</declname>
        </param>
        <briefdescription>
<para>Receive a message in multiple parts. </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> Comm that message should be recieved from. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">data</parametername>
</parameternamelist>
<parameterdescription>
<para>char ** Pointer to buffer where message should be stored. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t Size of data buffer. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">headlen</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t Size of header in data buffer. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">allow_realloc</parametername>
</parameternamelist>
<parameterdescription>
<para>int If 1, data will be realloced if the incoming message is larger than the buffer. Otherwise, an error will be returned. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if unsucessful, size of message received otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="697" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="697" bodyend="844"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a32fb628a1867b8600f9193f926bff837" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_recv</definition>
        <argsstring>(const comm_t x, char *data, const size_t len)</argsstring>
        <name>comm_recv</name>
        <param>
          <type>const <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>
        <briefdescription>
<para>Receive a message from an input comm. An error will be returned if the buffer is not large enough. </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>character pointer to allocated buffer where the message should be saved. </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>
</parameterlist>
<simplesect kind="return"><para>int -1 if message could not be received and -2 if EOF is received. Length of the received message otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="857" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="857" bodyend="872"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a727c9ffe585429d4edb4bad794d21bef" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_recv_realloc</definition>
        <argsstring>(const comm_t x, char **data, const size_t len)</argsstring>
        <name>comm_recv_realloc</name>
        <param>
          <type>const <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>
        <briefdescription>
<para>Receive a message from an input comm, reallocating as necessary. </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>character pointer to pointer to allocated buffer where the message should be saved. </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>
</parameterlist>
<simplesect kind="return"><para>int -1 if message could not be received and -2 if EOF is received. Length of the received message otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="884" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="884" bodyend="899"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a9aaca31a300de4bb2aa442a1f8ab6b42" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send_nolimit</definition>
        <argsstring>(const comm_t x, const char *data, const size_t len)</argsstring>
        <name>comm_send_nolimit</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>alias for comm_send. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="904" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="904" bodyend="906"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a0a9a598890dde188e980853b1ddddcf8" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_send_nolimit_eof</definition>
        <argsstring>(const comm_t x)</argsstring>
        <name>comm_send_nolimit_eof</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <briefdescription>
<para>Send EOF 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 message should be sent to. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int 0 if send successfull, -1 otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="914" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="914" bodyend="932"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a874fb6254f667271606084dda6192509" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int comm_recv_nolimit</definition>
        <argsstring>(const comm_t x, char **data, const size_t len)</argsstring>
        <name>comm_recv_nolimit</name>
        <param>
          <type>const <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>
        <briefdescription>
<para>Receive a large message from an input comm. Receive a message larger than CIS_MSG_MAX bytes from an input comm by receiving it in parts. This expects the first message to be the size of the total message. </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>character pointer to pointer for allocated buffer where the message should be stored. A pointer to a pointer is used so that the buffer may be reallocated as necessary for the incoming message. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">len</parametername>
</parameternamelist>
<parameterdescription>
<para>size_t length of the initial allocated message buffer in bytes. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if message could not be received and -2 if EOF is received. Length of the received message otherwise. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="948" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="948" bodyend="950"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a33775e2f4e21bae3bcf64820ff646f9a" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int vcommSend</definition>
        <argsstring>(const comm_t x, va_list ap)</argsstring>
        <name>vcommSend</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <param>
          <type>va_list</type>
          <declname>ap</declname>
        </param>
        <briefdescription>
<para>Send arguments as a small formatted message to an output comm. Use the format string to create a message from the input arguments that is then sent to the specified output comm. If the message is larger than CIS_MSG_MAX or cannot be encoded, it will not be sent. <linebreak/>
 </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 for comm that message should be sent to. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">ap</parametername>
</parameternamelist>
<parameterdescription>
<para>va_list arguments to be formatted into a message using sprintf. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int Number of arguments formatted if send succesfull, -1 if send unsuccessful. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="963" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="963" bodyend="996"/>
      </memberdef>
      <memberdef kind="function" id="communication_8h_1a6a0a86756faad24dba5205b12b613fa6" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>static int vcommRecv</definition>
        <argsstring>(const comm_t x, va_list ap)</argsstring>
        <name>vcommRecv</name>
        <param>
          <type>const <ref refid="structcomm__t" kindref="compound">comm_t</ref></type>
          <declname>x</declname>
        </param>
        <param>
          <type>va_list</type>
          <declname>ap</declname>
        </param>
        <briefdescription>
<para>Assign arguments by receiving and parsing a message from an input comm. Receive a message smaller than CIS_MSG_MAX bytes from an input comm and parse it using the associated format string. </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 for comm that message should be sent to. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="out">ap</parametername>
</parameternamelist>
<parameterdescription>
<para>va_list arguments that should be assigned by parsing the received message using sscanf. As these are being assigned, they should be pointers to memory that has already been allocated. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>int -1 if message could not be received or could not be parsed. Length of the received message if message was received and parsed. -2 is returned if EOF is received. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" line="1011" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/communication/communication.h" bodystart="1011" bodyend="1048"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="2"><highlight class="preprocessor">#ifndef<sp/>CISCOMMUNICATION_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>CISCOMMUNICATION_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;../tools.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;../serialize/serialize.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><highlight class="preprocessor">#include<sp/>&lt;CommBase.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;IPCComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;ZMQComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;RPCComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;ServerComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;ClientComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;AsciiFileComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;AsciiTableComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;DefaultComm.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><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="19"><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="20"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**vcomms2clean<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>ncomms2clean<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>clean_registered<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Forward<sp/>declaration<sp/>of<sp/>eof</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_eof(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x);</highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_nmsg(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x);</highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"></highlight></codeline>
<codeline lineno="39"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>free_comm_type(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_ipc_comm(x);</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_zmq_comm(x);</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_rpc_comm(x);</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_server_comm(x);</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_client_comm(x);</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_ascii_file_comm(x);</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((t<sp/>==<sp/>ASCII_TABLE_COMM)<sp/>||<sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM))</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>free_ascii_table_comm(x);</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;free_comm_type:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="61"><highlight class="normal">};</highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>free_comm(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x<sp/>==<sp/>NULL)</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;free_comm(%s)&quot;</highlight><highlight class="normal">,<sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Send<sp/>EOF<sp/>for<sp/>output<sp/>comms<sp/>and<sp/>then<sp/>wait<sp/>for<sp/>messages<sp/>to<sp/>be<sp/>recv&apos;d</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((is_send(x-&gt;<ref refid="structcomm__t_1a1940bbad161f8cf5f868ff4cf4e95cda" kindref="member">direction</ref>))<sp/>&amp;&amp;<sp/>(x-&gt;<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref>))<sp/>{</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(_cis_error_flag<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;free_comm(%s):<sp/>Sending<sp/>EOF&quot;</highlight><highlight class="normal">,<sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>comm_send_eof(*x);</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(comm_nmsg(*x)<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;free_comm(%s):<sp/>draining<sp/>%d<sp/>messages&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>comm_nmsg(*x));</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>usleep(CIS_SLEEP_TIME);</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;free_comm(%s):<sp/>Error<sp/>registered&quot;</highlight><highlight class="normal">,<sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>free_comm_type(x);</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>idx<sp/>=<sp/>x-&gt;<ref refid="structcomm__t_1a87f3a39926576e049b9ddc0cbabc9c95" kindref="member">index_in_register</ref>;</highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/>free_comm_base(x);</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(idx<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(vcomms2clean[idx]<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(vcomms2clean[idx]);</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>vcomms2clean[idx]<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="98"><highlight class="normal">};</highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>clean_comms(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;atexit<sp/>begin&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>ncomms2clean;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(vcomms2clean[i]<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm((<ref refid="structcomm__t" kindref="compound">comm_t</ref>*)(vcomms2clean[i]));</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(vcomms2clean<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/>free(vcomms2clean);</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/>vcomms2clean<sp/>=<sp/>NULL;</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/>ncomms2clean<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>defined(ZMQINSTALLED)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>#if<sp/>defined(_WIN32)<sp/>&amp;&amp;<sp/>defined(ZMQINSTALLED)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/>zsys_shutdown();</highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;atexit<sp/>done&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>printf(&quot;&quot;);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal">};</highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>register_comm(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(clean_registered<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/>atexit(clean_comms);</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/>clean_registered<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x<sp/>==<sp/>NULL)<sp/>{</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/>}</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**t_vcomms2clean<sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">**)realloc(vcomms2clean,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)*(ncomms2clean<sp/>+<sp/>1));</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t_vcomms2clean<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;register_comm(%s):<sp/>Failed<sp/>to<sp/>realloc<sp/>the<sp/>comm<sp/>list.&quot;</highlight><highlight class="normal">,<sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/>vcomms2clean<sp/>=<sp/>t_vcomms2clean;</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/>x-&gt;<ref refid="structcomm__t_1a87f3a39926576e049b9ddc0cbabc9c95" kindref="member">index_in_register</ref><sp/>=<sp/>(int)ncomms2clean;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/>vcomms2clean[ncomms2clean++]<sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)x;</highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="149"><highlight class="normal">};</highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>new_comm_type(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>flag;</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_ipc_address(x);</highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_zmq_address(x);</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_rpc_address(x);</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_server_address(x);</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_client_address(x);</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_ascii_file_address(x);</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_TABLE_COMM)</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_ascii_table_address(x);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM)</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_ascii_table_array_address(x);</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;new_comm_type:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>flag;</highlight></codeline>
<codeline lineno="182"><highlight class="normal">};</highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight></codeline>
<codeline lineno="190"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>init_comm_type(<ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x)<sp/>{</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>flag;</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_ipc_comm(x);</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_zmq_comm(x);</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_rpc_comm(x);</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_server_comm(x);</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_client_comm(x);</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_ascii_file_comm(x);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_TABLE_COMM)</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_ascii_table_comm(x);</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM)</highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_ascii_table_array_comm(x);</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_comm_type:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;init_comm_type(%s):<sp/>Done,<sp/>flag<sp/>=<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>x-&gt;<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>flag);</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>flag;</highlight></codeline>
<codeline lineno="216"><highlight class="normal">};</highlight></codeline>
<codeline lineno="217"><highlight class="normal"></highlight></codeline>
<codeline lineno="228"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>new_comm(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*address,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*direction,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>comm_type<sp/>t,</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*seri_info)<sp/>{</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*ret<sp/>=<sp/>new_comm_base(address,<sp/>direction,<sp/>t,<sp/>seri_info);</highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;new_comm:<sp/>Could<sp/>not<sp/>initialize<sp/>base.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>empty_comm_base();</highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>flag;</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(address<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>new_comm_type(ret);</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>init_comm_type(ret);</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flag<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;new_comm:<sp/>Failed<sp/>to<sp/>initialize<sp/>new<sp/>comm<sp/>address.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/>ret-&gt;valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(strlen(ret-&gt;name)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>sprintf(ret-&gt;name,<sp/></highlight><highlight class="stringliteral">&quot;temp.%s&quot;</highlight><highlight class="normal">,<sp/>ret-&gt;address);</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>register_comm(ret);</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flag<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;new_comm:<sp/>Failed<sp/>to<sp/>register<sp/>new<sp/>comm.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret-&gt;valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret[0];</highlight></codeline>
<codeline lineno="256"><highlight class="normal">};</highlight></codeline>
<codeline lineno="257"><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>init_comm(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*name,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*direction,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>comm_type<sp/>t,</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*seri_info)<sp/>{</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;init_comm:<sp/>Initializing<sp/>comm.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="274"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>_WIN32</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/>SetErrorMode(SEM_FAILCRITICALERRORS<sp/>|<sp/>SEM_NOGPFAULTERRORBOX);</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/>_set_abort_behavior(0,_WRITE_ABORT_MSG);</highlight></codeline>
<codeline lineno="277"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*ret<sp/>=<sp/>init_comm_base(name,<sp/>direction,<sp/>t,<sp/>seri_info);</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_comm(%s):<sp/>Could<sp/>not<sp/>initialize<sp/>base.&quot;</highlight><highlight class="normal">,<sp/>name);</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>empty_comm_base();</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>flag<sp/>=<sp/>init_comm_type(ret);</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flag<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_comm(%s):<sp/>Could<sp/>not<sp/>initialize<sp/>comm.&quot;</highlight><highlight class="normal">,<sp/>name);</highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/>ret-&gt;valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/>flag<sp/>=<sp/>register_comm(ret);</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flag<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;init_comm(%s):<sp/>Failed<sp/>to<sp/>register<sp/>new<sp/>comm.&quot;</highlight><highlight class="normal">,<sp/>name);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret-&gt;valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;init_comm(%s):<sp/>Initialized<sp/>comm.&quot;</highlight><highlight class="normal">,<sp/>name);</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret[0];</highlight></codeline>
<codeline lineno="296"><highlight class="normal">};</highlight></codeline>
<codeline lineno="297"><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>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="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_nmsg:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ipc_comm_nmsg(x);</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>zmq_comm_nmsg(x);</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>rpc_comm_nmsg(x);</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>server_comm_nmsg(x);</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>client_comm_nmsg(x);</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_file_comm_nmsg(x);</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((t<sp/>==<sp/>ASCII_TABLE_COMM)<sp/>||<sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM))</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_table_comm_nmsg(x);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_nmsg:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="329"><highlight class="normal">};</highlight></codeline>
<codeline lineno="330"><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="341"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_single(</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="342"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_single:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ipc_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>zmq_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>rpc_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>server_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>client_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_file_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((t<sp/>==<sp/>ASCII_TABLE_COMM)<sp/>||<sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM))</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_table_comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_single:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/>time(x.<ref refid="structcomm__t_1adc0fcb148259e9801f63e70f7945e31b" kindref="member">last_send</ref>);</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>time_t<sp/>now;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>time(&amp;now);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>x.last_send[0]<sp/>=<sp/>now;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="372"><highlight class="normal">};</highlight></codeline>
<codeline lineno="373"><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref><sp/>comm_send_multipart_header(</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/>*<sp/>data,</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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="386"><highlight class="normal"><sp/><sp/><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref><sp/>head<sp/>=<sp/>init_header(len,<sp/>NULL,<sp/>NULL);</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/>sprintf(head.<ref refid="structcomm__head__t_1ade03bb53d07aaffff906db9a8d95da02" kindref="member">id</ref>,<sp/></highlight><highlight class="stringliteral">&quot;%d&quot;</highlight><highlight class="normal">,<sp/>rand());</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/>head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/>head.<ref refid="structcomm__head__t_1a541f991a66b2422bec7b1cc25b5dd567" kindref="member">valid</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>serializer<sp/>information<sp/>to<sp/>header<sp/>on<sp/>first<sp/>send</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>==<sp/>0)<sp/>&amp;&amp;<sp/>(x.<ref refid="structcomm__t_1a2d004dd7203d970ac2f398a25276ad2f" kindref="member">is_file</ref><sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structseri__t" kindref="compound">seri_t</ref><sp/>*serializer;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>CLIENT_COMM)<sp/>{</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><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="395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>serializer<sp/>=<sp/>req_comm-&gt;<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>serializer<sp/>=<sp/>x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>DIRECT_SERI)<sp/>{</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>FORMAT_SERI)<sp/>{</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1acfddb7dfc30cd546036af32cab2295e2" kindref="member">format_str</ref>,<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)(serializer-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>));</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>ARRAY_SERI)<sp/>{</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1acfddb7dfc30cd546036af32cab2295e2" kindref="member">format_str</ref>,<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)(serializer-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>));</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a68f4fd55f648414958edcd564be498b7" kindref="member">as_array</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>ASCII_TABLE_SERI)<sp/>{</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref><sp/>*table<sp/>=<sp/>(<ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref>*)(serializer-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1acfddb7dfc30cd546036af32cab2295e2" kindref="member">format_str</ref>,<sp/>table-&gt;<ref refid="structasciiTable__t_1a030a09e49d0cb900ae0e3f6103229d14" kindref="member">format_str</ref>);</highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>ASCII_TABLE_ARRAY_SERI)<sp/>{</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>2;</highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref><sp/>*table<sp/>=<sp/>(<ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref>*)(serializer-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1acfddb7dfc30cd546036af32cab2295e2" kindref="member">format_str</ref>,<sp/>table-&gt;<ref refid="structasciiTable__t_1a030a09e49d0cb900ae0e3f6103229d14" kindref="member">format_str</ref>);</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a68f4fd55f648414958edcd564be498b7" kindref="member">as_array</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>PLY_SERI)<sp/>{</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>8;</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(serializer-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>OBJ_SERI)<sp/>{</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>=<sp/>9;</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>*x0;</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>SERVER_COMM)<sp/>{</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><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="426"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(res_comm[0]<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart_header(%s):<sp/>no<sp/>response<sp/>comm<sp/>registered&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a541f991a66b2422bec7b1cc25b5dd567" kindref="member">valid</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>head;</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/>x0<sp/>=<sp/>&amp;((*res_comm)[0]);</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Why<sp/>was<sp/>this<sp/>necessary?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1ade03bb53d07aaffff906db9a8d95da02" kindref="member">id</ref>,<sp/>x.<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>);</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>CLIENT_COMM)<sp/>{</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!(is_eof(data)))<sp/>{</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head<sp/>=<sp/>client_response_header(x,<sp/>head);</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/>x0<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="440"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/>x0<sp/>=<sp/>&amp;x;</highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>ZMQ<sp/>header<sp/>info</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x0-&gt;<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>ZMQ_COMM)<sp/>{</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*reply_address<sp/>=<sp/>set_reply_send(x0);</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(reply_address<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart_header:<sp/>Could<sp/>not<sp/>set<sp/>reply<sp/>address.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a541f991a66b2422bec7b1cc25b5dd567" kindref="member">valid</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>head;</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1a81034ab274964279115f5ce7669f055b" kindref="member">zmq_reply</ref>,<sp/>reply_address);</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>head;</highlight></codeline>
<codeline lineno="454"><highlight class="normal">};</highlight></codeline>
<codeline lineno="455"><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_multipart(</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="465"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//char<sp/>headbuf[CIS_MSG_BUF];</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>headbuf_len<sp/>=<sp/>CIS_MSG_BUF;</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>headlen<sp/>=<sp/>0,<sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>xmulti<sp/>=<sp/>empty_comm_base();</highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>header</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/><ref refid="structcomm__head__t" kindref="compound">comm_head_t</ref><sp/>head<sp/>=<sp/>comm_send_multipart_header(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="475"><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/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Invalid<sp/>header<sp/>generated.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*headbuf<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)malloc(headbuf_len);</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(headbuf<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>malloc<sp/>headbuf.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Try<sp/>to<sp/>send<sp/>body<sp/>in<sp/>header</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(len<sp/>&lt;<sp/>x.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref>)<sp/>{</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/>headlen<sp/>=<sp/>format_comm_header(head,<sp/>headbuf,<sp/>headbuf_len);</highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(headlen<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>format<sp/>header.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">)headlen<sp/>+<sp/>len)<sp/>&lt;<sp/>x.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref>)<sp/>{</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">)headlen<sp/>+<sp/>len<sp/>+<sp/>1)<sp/>&gt;<sp/>(</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">)headbuf_len)<sp/>{</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*t_headbuf<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)realloc(headbuf,<sp/>(</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">)headlen<sp/>+<sp/>len<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t_headbuf<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>realloc<sp/>headbuf.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/>headbuf<sp/>=<sp/>t_headbuf;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>headbuf_len<sp/>=<sp/>headlen<sp/>+<sp/>(int)len<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>memcpy(headbuf<sp/>+<sp/>headlen,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>headlen<sp/>+=<sp/>(int)len;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>headbuf[headlen]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>head<sp/>string</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref><sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>address<sp/>for<sp/>new<sp/>comm<sp/>and<sp/>add<sp/>to<sp/>header</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/>xmulti<sp/>=<sp/>new_comm(NULL,<sp/></highlight><highlight class="stringliteral">&quot;send&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>,<sp/>NULL);</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!(xmulti.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref>))<sp/>{</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>initialize<sp/>a<sp/>new<sp/>comm.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a9b44169ff04756e8802bb2510892cf56" kindref="member">is_work_comm</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1af762f3a390be988bb2f9dca01a7b5bb5" kindref="member">address</ref>,<sp/>xmulti.<ref refid="structcomm__t_1aca2bf1fc2b62c779c50848501f31fbf0" kindref="member">address</ref>);</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(xmulti.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>ZMQ_COMM)<sp/>{</highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*reply_address<sp/>=<sp/>set_reply_send(&amp;xmulti);</highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(reply_address<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Could<sp/>not<sp/>set<sp/>worker<sp/>reply<sp/>address.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>strcpy(head.<ref refid="structcomm__head__t_1a1367a9bb9ef1938d87897ab5685b01ef" kindref="member">zmq_reply_worker</ref>,<sp/>reply_address);</highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/>headlen<sp/>=<sp/>format_comm_header(head,<sp/>headbuf,<sp/>headbuf_len);</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(headlen<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>format<sp/>header.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Send<sp/>header</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>comm_send_single(x,<sp/>headbuf,<sp/>headlen);</highlight></codeline>
<codeline lineno="540"><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="541"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_multipart:<sp/>Failed<sp/>to<sp/>send<sp/>header.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref><sp/>==<sp/>1)</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send_multipart(%s):<sp/>%d<sp/>bytes<sp/>completed&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Send<sp/>multipart</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>msgsiz;</highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>prev<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(prev<sp/>&lt;<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>)<sp/>{</highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>-<sp/>prev)<sp/>&gt;<sp/>xmulti.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref>)</highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>msgsiz<sp/>=<sp/>xmulti.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref>;</highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>msgsiz<sp/>=<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>-<sp/>prev;</highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_send_single(xmulti,<sp/>data<sp/>+<sp/>prev,<sp/>msgsiz);</highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send_multipart(%s):<sp/>send<sp/>interupted<sp/>at<sp/>%d<sp/>of<sp/>%d<sp/>bytes.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>prev,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/>prev<sp/>+=<sp/>msgsiz;</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send_multipart(%s):<sp/>%d<sp/>of<sp/>%d<sp/>bytes<sp/>sent&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>prev,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send_multipart(%s):<sp/>%d<sp/>bytes<sp/>completed&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Free<sp/>multipart</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/>free(headbuf);</highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="578"><highlight class="normal">};</highlight></codeline>
<codeline lineno="579"><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"></highlight></codeline>
<codeline lineno="590"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="591"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>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="592"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref><sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send(%s):<sp/>sent_eof<sp/>not<sp/>initialized.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>sending_eof<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof(data))<sp/>{</highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>CLIENT_COMM)<sp/>{</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><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="607"><highlight class="normal"><sp/><sp/><sp/><sp/>req_comm-&gt;<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>sending_eof<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send(%s):<sp/>Sending<sp/>EOF&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send(%s):<sp/>EOF<sp/>already<sp/>sent&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((len<sp/>&gt;<sp/>x.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref>)<sp/>&amp;&amp;<sp/>(x.<ref refid="structcomm__t_1a9aecec459dff6ce20398f1c110f8f3f4" kindref="member">maxMsgSize</ref><sp/>&gt;<sp/>0))<sp/>||</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(((x.<ref refid="structcomm__t_1a9810578a787d8503b00bcb78a592073d" kindref="member">always_send_header</ref>)<sp/>||<sp/>(x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>==<sp/>0))))<sp/>{<sp/></highlight><highlight class="comment">//<sp/>&amp;&amp;<sp/>(!(is_eof(data)))))<sp/>{</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_send_multipart(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send(%s):<sp/>Sending<sp/>as<sp/>single<sp/>message<sp/>without<sp/>a<sp/>header.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_send_single(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(sending_eof)<sp/>{</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_send(%s):<sp/>sent<sp/>EOF,<sp/>ret<sp/>=<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>ret);</highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="630"><highlight class="normal">};</highlight></codeline>
<codeline lineno="631"><highlight class="normal"></highlight></codeline>
<codeline lineno="637"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_eof(</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="639"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>buf[100]<sp/>=<sp/>CIS_MSG_EOF;</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>comm_send(x,<sp/>buf,<sp/>strlen(buf));</highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="643"><highlight class="normal">};</highlight></codeline>
<codeline lineno="644"><highlight class="normal"></highlight></codeline>
<codeline lineno="657"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_recv_single(</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="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,</highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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="660"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_single:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/>comm_type<sp/>t<sp/>=<sp/>x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>IPC_COMM)</highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ipc_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ZMQ_COMM)</highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>zmq_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>RPC_COMM)</highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>rpc_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>SERVER_COMM)</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>server_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>CLIENT_COMM)</highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>client_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t<sp/>==<sp/>ASCII_FILE_COMM)</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_file_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((t<sp/>==<sp/>ASCII_TABLE_COMM)<sp/>||<sp/>(t<sp/>==<sp/>ASCII_TABLE_ARRAY_COMM))</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>ascii_table_comm_recv(x,<sp/>data,<sp/>len,<sp/>allow_realloc);</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv:<sp/>Unsupported<sp/>comm_type<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>t);</highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="684"><highlight class="normal">};</highlight></codeline>
<codeline lineno="685"><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_recv_multipart(</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="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,</highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>headlen,<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="699"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/>usleep(100);</highlight></codeline>
<codeline lineno="705"><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/>headlen);</highlight></codeline>
<codeline lineno="706"><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="707"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%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="708"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>serializer<sp/>information<sp/>from<sp/>header<sp/>on<sp/>first<sp/>recv</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>==<sp/>0)<sp/>&amp;&amp;<sp/>(x.<ref refid="structcomm__t_1a2d004dd7203d970ac2f398a25276ad2f" kindref="member">is_file</ref><sp/>==<sp/>0)<sp/>&amp;&amp;<sp/>(x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>-&gt;<ref refid="structseri__t_1a4278a7440cc158eb8c28010c5ad73724" kindref="member">type</ref><sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>new_type<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*new_info<sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)(head.<ref refid="structcomm__head__t_1acfddb7dfc30cd546036af32cab2295e2" kindref="member">format_str</ref>);</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Updating<sp/>serializer<sp/>type<sp/>to<sp/>%d&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref>);</highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>DIRECT_SERI;</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>FORMAT_SERI;</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>2)<sp/>{</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>ASCII_TABLE_ARRAY_SERI;</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>TODO:<sp/>Treat<sp/>this<sp/>as<sp/>a<sp/>separate<sp/>class</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>new_type<sp/>=<sp/>ARRAY_SERI;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>3)<sp/>{</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a68f4fd55f648414958edcd564be498b7" kindref="member">as_array</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>ASCII_TABLE_SERI;</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>ASCII_TABLE_ARRAY_SERI;</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>8)<sp/>{</highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>PLY_SERI;</highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a4d963ff774cc3537d8944856b2365c6a" kindref="member">serializer_type</ref><sp/>==<sp/>9)<sp/>{</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/>new_type<sp/>=<sp/>OBJ_SERI;</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_type<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>update_serializer(x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>,<sp/>new_type,<sp/>new_info);</highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Error<sp/>updating<sp/>serializer.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Set<sp/>name<sp/>for<sp/>debug<sp/>info<sp/>&amp;<sp/>simplify<sp/>formats</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((new_type<sp/>==<sp/>ASCII_TABLE_SERI)<sp/>||<sp/>(new_type<sp/>==<sp/>ASCII_TABLE_ARRAY_SERI))<sp/>{</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref><sp/>*table<sp/>=<sp/>(<ref refid="structasciiTable__t" kindref="compound">asciiTable_t</ref>*)(x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>-&gt;<ref refid="structseri__t_1afe8d056809d1f3155b50603a620a52ab" kindref="member">info</ref>);</highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>at_update(table,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/></highlight><highlight class="stringliteral">&quot;0&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Failed<sp/>to<sp/>update<sp/>asciiTable<sp/>address.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>simplify_formats(table-&gt;<ref refid="structasciiTable__t_1a030a09e49d0cb900ae0e3f6103229d14" kindref="member">format_str</ref>,<sp/>CIS_MSG_MAX);</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Failed<sp/>to<sp/>simplify<sp/>recvd<sp/>table<sp/>format.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_type<sp/>==<sp/>FORMAT_SERI)<sp/>{</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<sp/>format_str<sp/>=<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="758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>simplify_formats(format_str,<sp/>x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>-&gt;<ref refid="structseri__t_1a6cf49790453343f2ebb5690b68342ac1" kindref="member">size_info</ref>);</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Failed<sp/>to<sp/>simplify<sp/>recvd<sp/>format.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a6f14ffcda4738e5e4b498b05a802f293" kindref="member">multipart</ref>)<sp/>{</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Move<sp/>part<sp/>of<sp/>message<sp/>after<sp/>header<sp/>to<sp/>front<sp/>of<sp/>data</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>memmove(*data,<sp/>*data<sp/>+<sp/>head.<ref refid="structcomm__head__t_1a5e01ad7e302f5597bccfcf208cdcbe0a" kindref="member">bodybeg</ref>,<sp/>head.<ref refid="structcomm__head__t_1a981bda83ada0637a0153dcd6c46420f0" kindref="member">bodysiz</ref>);</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(*data)[head.<ref refid="structcomm__head__t_1a981bda83ada0637a0153dcd6c46420f0" kindref="member">bodysiz</ref>]<sp/>=<sp/></highlight><highlight class="charliteral">&apos;\0&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof(*data))<sp/>{</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>EOF<sp/>received.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-2;</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Return<sp/>early<sp/>if<sp/>header<sp/>contained<sp/>entire<sp/>message</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>==<sp/>head.<ref refid="structcomm__head__t_1a981bda83ada0637a0153dcd6c46420f0" kindref="member">bodysiz</ref>)<sp/>{</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(head.<ref refid="structcomm__head__t_1a981bda83ada0637a0153dcd6c46420f0" kindref="member">bodysiz</ref>);</highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>address<sp/>for<sp/>new<sp/>comm</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>xmulti<sp/>=<sp/>new_comm(head.<ref refid="structcomm__head__t_1af762f3a390be988bb2f9dca01a7b5bb5" kindref="member">address</ref>,<sp/></highlight><highlight class="stringliteral">&quot;recv&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref>,<sp/>NULL);</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!(xmulti.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref>))<sp/>{</highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart:<sp/>Failed<sp/>to<sp/>initialize<sp/>a<sp/>new<sp/>comm.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>xmulti.<ref refid="structcomm__t_1a9b44169ff04756e8802bb2510892cf56" kindref="member">is_work_comm</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(xmulti.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>ZMQ_COMM)<sp/>{</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>reply_socket<sp/>=<sp/>set_reply_recv(&amp;xmulti,<sp/>head.<ref refid="structcomm__head__t_1a1367a9bb9ef1938d87897ab5685b01ef" kindref="member">zmq_reply_worker</ref>);</highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(reply_socket<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart:<sp/>Failed<sp/>to<sp/>set<sp/>worker<sp/>reply<sp/>address.&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Receive<sp/>parts<sp/>of<sp/>message</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>prev<sp/>=<sp/>head.<ref refid="structcomm__head__t_1a981bda83ada0637a0153dcd6c46420f0" kindref="member">bodysiz</ref>;</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>msgsiz<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Reallocate<sp/>data<sp/>if<sp/>necessary</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>+<sp/>1)<sp/>&gt;<sp/>len)<sp/>{</highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(allow_realloc)<sp/>{</highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*t_data<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)realloc(*data,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(t_data<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>Failed<sp/>to<sp/>realloc<sp/>buffer&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>free(*data);</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*data<sp/>=<sp/>t_data;</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>buffer<sp/>is<sp/>not<sp/>large<sp/>enough&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*pos<sp/>=<sp/>(*data)<sp/>+<sp/>prev;</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(prev<sp/>&lt;<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>)<sp/>{</highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/>msgsiz<sp/>=<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref><sp/>-<sp/>prev<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_recv_single(xmulti,<sp/>&amp;pos,<sp/>msgsiz,<sp/>0);</highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>recv<sp/>interupted<sp/>at<sp/>%d<sp/>of<sp/>%d<sp/>bytes.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>prev,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/><sp/><sp/>prev<sp/>+=<sp/>ret;</highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/>pos<sp/>+=<sp/>ret;</highlight></codeline>
<codeline lineno="829"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>%d<sp/>of<sp/>%d<sp/>bytes<sp/>received&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>prev,<sp/>head.<ref refid="structcomm__head__t_1a61721f46c3f5850a5e65e28d497da0fb" kindref="member">size</ref>);</highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_multipart(%s):<sp/>%d<sp/>bytes<sp/>completed&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>prev);</highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>(int)prev;</highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_comm(&amp;xmulti);</highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>(int)headlen;</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a7a90d80ee6c1826d0fc152dc3a3f61a1" kindref="member">used</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="844"><highlight class="normal">};</highlight></codeline>
<codeline lineno="845"><highlight class="normal"></highlight></codeline>
<codeline lineno="856"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="857"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_recv(</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="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="858"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>comm_recv_single(x,<sp/>&amp;data,<sp/>len,<sp/>0);</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof(data))<sp/>{</highlight></codeline>
<codeline lineno="861"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv(%s):<sp/>EOF<sp/>received.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="862"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="863"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-2;</highlight></codeline>
<codeline lineno="864"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_recv_multipart(x,<sp/>&amp;data,<sp/>len,<sp/>ret,<sp/>0);</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="867"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_realloc(%s):<sp/>Failed<sp/>to<sp/>receive<sp/>header<sp/>or<sp/>message.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="870"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="871"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="872"><highlight class="normal">};</highlight></codeline>
<codeline lineno="873"><highlight class="normal"></highlight></codeline>
<codeline lineno="883"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_recv_realloc(</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="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="885"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>comm_recv_single(x,<sp/>data,<sp/>len,<sp/>1);</highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_eof(*data))<sp/>{</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;comm_recv_realloc(%s):<sp/>EOF<sp/>received.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a1d7418e5f54be56939a7f26b68a55f3d" kindref="member">recv_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>-2;</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_recv_multipart(x,<sp/>data,<sp/>len,<sp/>ret,<sp/>1);</highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_recv_realloc(%s):<sp/>Failed<sp/>to<sp/>receive<sp/>header<sp/>or<sp/>message.&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="899"><highlight class="normal">};</highlight></codeline>
<codeline lineno="900"><highlight class="normal"></highlight></codeline>
<codeline lineno="901"><highlight class="normal"></highlight></codeline>
<codeline lineno="903"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="904"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_nolimit(</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="905"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>comm_send(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="906"><highlight class="normal">};</highlight></codeline>
<codeline lineno="907"><highlight class="normal"></highlight></codeline>
<codeline lineno="913"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="914"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_send_nolimit_eof(</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="915"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="916"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="917"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_nolimit_eof:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="919"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="920"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref><sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_nolimit_eof(%s):<sp/>sent_eof<sp/>not<sp/>initialized.&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>buf[2048]<sp/>=<sp/>CIS_MSG_EOF;</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/>ret<sp/>=<sp/>comm_send_nolimit(x,<sp/>buf,<sp/>strlen(buf));</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a9c883133ed0ee04e11983dc7efbc8bfb" kindref="member">sent_eof</ref>[0]<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;comm_send_nolimit_eof(%s):<sp/>EOF<sp/>already<sp/>sent&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="932"><highlight class="normal">};</highlight></codeline>
<codeline lineno="933"><highlight class="normal"></highlight></codeline>
<codeline lineno="947"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="948"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>comm_recv_nolimit(</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="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="949"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>comm_recv_realloc(x,<sp/>data,<sp/>len);</highlight></codeline>
<codeline lineno="950"><highlight class="normal">};</highlight></codeline>
<codeline lineno="951"><highlight class="normal"></highlight></codeline>
<codeline lineno="962"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="963"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>vcommSend(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x,<sp/>va_list<sp/>ap)<sp/>{</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommSend:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>buf_siz<sp/>=<sp/>CIS_MSG_BUF;</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>char<sp/>*buf<sp/>=<sp/>NULL;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*buf<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)malloc(buf_siz);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(buf<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommSend(%s):<sp/>Failed<sp/>to<sp/>alloc<sp/>buffer&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="976"><highlight class="normal"><sp/><sp/><ref refid="structseri__t" kindref="compound">seri_t</ref><sp/>*serializer<sp/>=<sp/>x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="977"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>CLIENT_COMM)<sp/>{</highlight></codeline>
<codeline lineno="978"><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.<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/><sp/><sp/>serializer<sp/>=<sp/>handle-&gt;<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="980"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>args_used<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>serialize(*serializer,<sp/>&amp;buf,<sp/>buf_siz,<sp/>1,<sp/>&amp;args_used,<sp/>ap);</highlight></codeline>
<codeline lineno="983"><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="984"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommSend(%s):<sp/>serialization<sp/>error&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="985"><highlight class="normal"><sp/><sp/><sp/><sp/>free(buf);</highlight></codeline>
<codeline lineno="986"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>comm_send(x,<sp/>buf,<sp/>ret);</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;vcommSend(%s):<sp/>comm_send<sp/>returns<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>ret);</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/>free(buf);</highlight></codeline>
<codeline lineno="991"><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="992"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>args_used;</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="996"><highlight class="normal">};</highlight></codeline>
<codeline lineno="997"><highlight class="normal"></highlight></codeline>
<codeline lineno="1010"><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1011"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>vcommRecv(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structcomm__t" kindref="compound">comm_t</ref><sp/>x,<sp/>va_list<sp/>ap)<sp/>{</highlight></codeline>
<codeline lineno="1012"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1afe8a58007e764fb3f2e906025f89fe72" kindref="member">valid</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommRecv:<sp/>Invalid<sp/>comm&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="1015"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Receive<sp/>message</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>buf_siz<sp/>=<sp/>CIS_MSG_BUF;</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>char<sp/>*buf<sp/>=<sp/>NULL;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*buf<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)malloc(buf_siz);</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(buf<sp/>==<sp/>NULL)<sp/>{</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommSend(%s):<sp/>Failed<sp/>to<sp/>alloc<sp/>buffer&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>);</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>comm_recv_nolimit(x,<sp/>&amp;buf,<sp/>buf_siz);</highlight></codeline>
<codeline lineno="1026"><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="1027"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>cislog_error(&quot;vcommRecv(%s):<sp/>Error<sp/>receiving.&quot;,<sp/>x.name);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/><sp/><sp/>free(buf);</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;vcommRecv(%s):<sp/>comm_recv<sp/>returns<sp/>%d:<sp/>%.10s...&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>ret,<sp/>buf);</highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Deserialize<sp/>message</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><ref refid="structseri__t" kindref="compound">seri_t</ref><sp/>*serializer<sp/>=<sp/>x.<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x.<ref refid="structcomm__t_1a9bd691f3ae56e098b9edff7ad1628b3b" kindref="member">type</ref><sp/>==<sp/>SERVER_COMM)<sp/>{</highlight></codeline>
<codeline lineno="1035"><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.<ref refid="structcomm__t_1ab7b58a54178acddc3f641e3a285aab7f" kindref="member">handle</ref>);</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/>serializer<sp/>=<sp/>handle-&gt;<ref refid="structcomm__t_1a2c1ca12d0df5193d4a023301aa156e8f" kindref="member">serializer</ref>;</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>deserialize(*serializer,<sp/>buf,<sp/>ret,<sp/>ap);</highlight></codeline>
<codeline lineno="1039"><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="1040"><highlight class="normal"><sp/><sp/><sp/><sp/>cislog_error(</highlight><highlight class="stringliteral">&quot;vcommRecv(%s):<sp/>error<sp/>deserializing<sp/>message<sp/>(ret=%d)&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>ret);</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/>free(buf);</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/>cislog_debug(</highlight><highlight class="stringliteral">&quot;vcommRecv(%s):<sp/>deserialize_format<sp/>returns<sp/>%d&quot;</highlight><highlight class="normal">,<sp/>x.<ref refid="structcomm__t_1a0c8b237f48a50a181eab8447a87ec172" kindref="member">name</ref>,<sp/>ret);</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/>free(buf);</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="1048"><highlight class="normal">};</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"></highlight></codeline>
<codeline lineno="1050"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>vcommSend_nolimit<sp/>vcommSend</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1051"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>vcommRecv_nolimit<sp/>vcommRecv</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1052"><highlight class="normal"></highlight></codeline>
<codeline lineno="1053"><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="1054"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1055"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1056"><highlight class="normal"></highlight></codeline>
<codeline lineno="1057"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*CISCOMMUNICATION_H_*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="/root/cis_interface/cis_interface/cis_interface/communication/communication.h"/>
  </compounddef>
</doxygen>
