<?xml version="1.0"?>
<!--
 Copyright (c) 2000-2021 Ericsson Telecom AB
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v2.0
 which accompanies this distribution, and is available at
 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html

 Contributors:
  Balasko, Jeno
  Kovacs, Ferenc
  Raduly, Csaba
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:TitanLoggerApi="TitanLoggerApi" targetNamespace="TitanLoggerApi">


<!-- This would be the structure of an on-disk log file in XML format.
     It supports "merged" logs, i.e. from different components. -->
<element name="TitanLog">
  <complexType>
    <sequence minOccurs="0" maxOccurs="unbounded">
      <element name="entityId" type="TitanLoggerApi:ComponentIDType" />
      <element name="event"    type="TitanLoggerApi:TitanLogEvent"
               minOccurs="1"   maxOccurs="unbounded" />
    </sequence>
  </complexType>
</element>

<!-- An extra level of indirection to keep the component identification
     separate from the rest of the event data. -->
<element name="TitanSingleLogEvent">
  <complexType>
     <sequence>
      <element name="entityId" type="TitanLoggerApi:ComponentIDType" />
      <element name="event"    type="TitanLoggerApi:TitanLogEvent" />
     </sequence>
  </complexType>
</element>

<!-- Top level structure.  `Type' suffix removed.  Severity is stored until
     all event types are supported.
     This is meant for in-memory use only.
     The entity id/name is not part of this structure; it would be redundant
     to store the same information over and over again. -->
<complexType name="TitanLogEvent">
  <sequence>
    <element name="timestamp"  type="TitanLoggerApi:TimestampType" />
    <element name="sourceInfo" type="TitanLoggerApi:LocationInfo"
             minOccurs="0" maxOccurs="unbounded" />
    <element name="severity"   type="integer" />
    <element name="logEvent"   type="TitanLoggerApi:LogEventType" />
  </sequence>
</complexType>

<!-- It represents the number of seconds since the Unix epoch
     (00:00:00 UTC, January 1, 1970). This is the native information obtained
     from the OS. It is not converted to an XML data/time format (a string)
     for efficiency reasons. -->
<complexType name="TimestampType">
  <sequence>
    <element name="seconds" type="integer" />
    <element name="microSeconds" type="integer" />
  </sequence>
</complexType>

<!-- One level of "source information" -->
<complexType name="LocationInfo">
  <sequence>
    <element name="filename" type="string" />
    <element name="line"     type="integer" />
    <element name="ent_name" type="string" />
    <element name="ent_type">
      <simpleType>
        <restriction base="string">
          <enumeration value="unknown" />
          <enumeration value="controlpart" />
          <enumeration value="testcase" />
          <enumeration value="altstep" />
          <enumeration value="function" />
          <enumeration value="external_function" />
          <enumeration value="template" />
        </restriction>
      </simpleType>
    </element>
  </sequence>
</complexType>

<!-- Component identification.
     A separate name may be redundant inside a running system,
     but it has to be written to an external log file. -->
<complexType name="ComponentIDType">
  <sequence>
    <element name="id" type="integer" />
    <!-- name may be kept empty in memory, only needed on external storage -->
    <element name="name" type="string" />
  </sequence>
</complexType>


<complexType name="LogEventType">
  <choice>
    <element name="actionEvent"       type="TitanLoggerApi:Strings" />
    <element name="defaultEvent"      type="TitanLoggerApi:DefaultEvent" />
    <element name="errorLog"          type="TitanLoggerApi:Categorized" />
    <element name="executorEvent"     type="TitanLoggerApi:ExecutorEvent" />
    <element name="functionEvent"     type="TitanLoggerApi:FunctionEvent" />
    <element name="parallelEvent"     type="TitanLoggerApi:ParallelEvent"/>
    <element name="testcaseOp"        type="TitanLoggerApi:TestcaseEvent"/>
    <element name="portEvent"         type="TitanLoggerApi:PortEvent"/>
    <!-- STATISTICSs (Runtime.cc) -->
    <!-- element name="verdictStatistics" type="TitanLoggerApi:VerdictStatisticsType" / -->
    <element name="statistics"        type="TitanLoggerApi:StatisticsType" />

    <!-- TIMEROPs (Timer.cc) -->
    <element name="timerEvent"        type="TitanLoggerApi:TimerEvent" />
    <element name="userLog"           type="TitanLoggerApi:Strings" />
    <!-- VERDICTOPs (Runtime.cc) -->
    <element name="verdictOp"         type="TitanLoggerApi:VerdictOp" />

    <element name="warningLog"        type="TitanLoggerApi:Categorized" />

    <element name="matchingEvent"     type="TitanLoggerApi:MatchingEvent" />

    <element name="debugLog"          type="TitanLoggerApi:Categorized" />

    <element name="executionSummary"  type="TitanLoggerApi:ExecutionSummaryType" />

    <element name="unhandledEvent"    type="string" />
  </choice>
</complexType>

<complexType name="Strings">
  <sequence>
    <element name="str" type="string"  maxOccurs="unbounded"/>
  </sequence>
</complexType>

<complexType name="Categorized">
  <sequence>
    <element name="category" type="integer" />
    <element name="text"     type="string"  />
  </sequence>
</complexType>

<complexType name="ErrorEvent">
  <sequence>
    <!-- to be enabled later
    <element name="type">
      <simpleType>
        <restriction base="string">
          <enumeration value="unqualified" />
          <enumeration value="unbound" />
        </restriction>
      </simpleType>
    </element>
    -->
    <element name="text" type="string" />
  </sequence>
</complexType>

<complexType name="WarningEvent">
  <sequence>
    <!-- to be enabled later
    <element name="type">
      <simpleType>
        <restriction base="string">
          <enumeration value="unqualified" />
        </restriction>
      </simpleType>
    </element>
    -->
    <element name="text" type="string" />
  </sequence>
</complexType>

<complexType name="TestcaseEvent">
  <choice>
    <element name="testcaseStarted"  type="TitanLoggerApi:QualifiedName" />
    <element name="testcaseFinished" type="TitanLoggerApi:TestcaseType" />
    <!-- TODO: testcase-unqualif... -->
  </choice>
</complexType>

<complexType name="ParallelEvent">
  <choice>
    <element name="parallelPTC"      type="TitanLoggerApi:ParallelPTC"/>
    <element name="parallelPTC_exit" type="TitanLoggerApi:PTC_exit" />
    <element name="parallelPort"     type="TitanLoggerApi:ParPort" />
  </choice>
</complexType>

<simpleType name="RandomAction">
  <restriction base="string">
    <enumeration value="seed" />
    <enumeration value="read_out" />
  </restriction>
</simpleType>


<complexType name="FunctionEvent">
  <choice>
    <element name="unqualified" type="string" />
    <element name="random">
      <annotation>
        <documentation>seeding and reading the PRNG</documentation>
      </annotation>
      <complexType>
        <sequence>
          <element name="operation" type="TitanLoggerApi:RandomAction" />
          <element name="retval"    type="double" />
          <element name="intseed"   type="integer" />
        </sequence>
      </complexType>
    </element>
  </choice>
</complexType>

<complexType name="MatchingEvent">
  <choice>
    <element name="matchingDone"    type="TitanLoggerApi:MatchingDoneType" />
    <element name="matchingSuccess" type="TitanLoggerApi:MatchingSuccessType" />
    <element name="matchingFailure" type="TitanLoggerApi:MatchingFailureType" />
    <element name="matchingProblem" type="TitanLoggerApi:MatchingProblemType" />
    <element name="matchingTimeout" type="TitanLoggerApi:MatchingTimeout" />
  </choice>
</complexType>

<complexType name="TimerEvent">
  <choice>
    <element name="readTimer" type="TitanLoggerApi:TimerType" />
    <element name="startTimer" type="TitanLoggerApi:TimerType" />
    <element name="guardTimer" type="TitanLoggerApi:TimerGuardType" />
    <element name="stopTimer" type="TitanLoggerApi:TimerType" />
    <element name="timeoutTimer" type="TitanLoggerApi:TimerType" />
    <element name="timeoutAnyTimer" type="TitanLoggerApi:TimerAnyTimeoutType" />
    <element name="unqualifiedTimer" type="string" />
  </choice>
</complexType>

<complexType name="DefaultEvent">
  <choice>
    <element name="defaultopActivate"   type="TitanLoggerApi:DefaultOp" />
    <element name="defaultopDeactivate" type="TitanLoggerApi:DefaultOp" />
    <element name="defaultopExit"       type="TitanLoggerApi:DefaultOp" />
  </choice>
</complexType>

<complexType name="ExecutorEvent">
  <choice>
    <element name="executorRuntime"    type="TitanLoggerApi:ExecutorRuntime" />
    <element name="executorConfigdata" type="TitanLoggerApi:ExecutorConfigdata" />
    <element name="extcommandStart"    type="string" />
    <element name="extcommandSuccess"  type="string" />
    <element name="executorComponent"  type="TitanLoggerApi:ExecutorComponent" />
    <element name="logOptions"         type="string" />
    <element name="executorMisc"       type="TitanLoggerApi:ExecutorUnqualified" />
  </choice>
</complexType>

<complexType name="PortEvent">
  <choice>
    <element name="portQueue"        type="TitanLoggerApi:Port_Queue" />
    <element name="portState"        type="TitanLoggerApi:Port_State"/>

    <element name="procPortSend"     type="TitanLoggerApi:Proc_port_out" />
    <element name="procPortRecv"     type="TitanLoggerApi:Proc_port_in" />

    <element name="msgPortSend"      type="TitanLoggerApi:Msg_port_send" />
    <element name="msgPortRecv"      type="TitanLoggerApi:Msg_port_recv" />

    <element name="dualMapped"       type="TitanLoggerApi:Dualface_mapped" />
    <element name="dualDiscard"      type="TitanLoggerApi:Dualface_discard" />
    <element name="setState"         type="TitanLoggerApi:Setstate" />

    <element name="portMisc"         type="TitanLoggerApi:Port_Misc" />
  </choice>
</complexType>


<!-- ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ -->

<complexType name="TimerType">
  <sequence>
    <element name="name" type="string" />
    <element name="value" type="double" />
  </sequence>
</complexType>
<!-- A plain `double' would suffice as well... -->
<complexType name="TimerGuardType">
  <sequence>
    <element name="value" type="double" />
  </sequence>
</complexType>
<complexType name="TimerAnyTimeoutType">
  <sequence />
</complexType>

<complexType name="QualifiedName">
  <annotation>
    <documentation>
      Testcase name qualified with the module name
    </documentation>
  </annotation>
  <sequence>
    <element name="module_name" type="string"/>
    <element name="testcase_name" type="string"/>
  </sequence>
</complexType>

<complexType name="TestcaseType">
  <sequence>
    <element name="name"    type="TitanLoggerApi:QualifiedName" />
    <element name="verdict" type="TitanLoggerApi:Verdict" />
    <element name="reason"  type="string">
      <annotation>
        <documentation>
          This could be optional (minOccurs=0), but that would introduce
          another level of indirection.
          Instead, an empty reason string means "no reason".
        </documentation>
      </annotation>
    </element>

  </sequence>
</complexType>

<complexType name="ExecutionSummaryType">
  <sequence>
    <element name="numberOfTestcases" type="integer" />
    <element name="overallStatistics" type="string" />
  </sequence>
</complexType>

<complexType name="VerdictOp">
  <choice>
    <element name="setVerdict"   type="TitanLoggerApi:SetVerdictType" />
    <element name="getVerdict"   type="TitanLoggerApi:Verdict" />
    <element name="finalVerdict" type="TitanLoggerApi:FinalVerdictType" />
  </choice>
</complexType>

<complexType name="StatisticsType">
  <choice>
    <element name="verdictStatistics">
      <complexType>
        <sequence>
          <element name="none"          type="integer" />
          <element name="nonePercent"   type="float" />
          <element name="pass"          type="integer" />
          <element name="passPercent"   type="float" />
          <element name="inconc"        type="integer" />
          <element name="inconcPercent" type="float" />
          <element name="fail"          type="integer" />
          <element name="failPercent"   type="float" />
          <element name="error"         type="integer" />
          <element name="errorPercent"  type="float" />
        </sequence>
      </complexType>
    </element>
    <element name="controlpartStart"  type="string" />
    <element name="controlpartFinish" type="string" />
    <element name="controlpartErrors" type="integer" />
  </choice>
</complexType>

<complexType name="SetVerdictType">
  <annotation><documentation>VERDICTOP_SETVERDICT</documentation></annotation>
  <sequence>
    <element name="newVerdict"   type="TitanLoggerApi:Verdict" />
    <element name="oldVerdict"   type="TitanLoggerApi:Verdict" />
    <element name="localVerdict" type="TitanLoggerApi:Verdict" />
    <element name="oldReason"    type="string" minOccurs="0" maxOccurs="1" />
    <element name="newReason"    type="string" minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>
<complexType name="VerdictType">
  <sequence>
    <element name="fromVerdict"   type="TitanLoggerApi:Verdict" />
    <element name="toVerdict"     type="TitanLoggerApi:Verdict" />
    <element name="verdictReason" type="string" minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>
<complexType name="FinalVerdictType">
  <annotation><documentation>VERDICTOP_FINAL</documentation></annotation>
  <choice>
    <element name="info" type="TitanLoggerApi:FinalVerdictInfo" />
    <element name="notification">
      <simpleType>
        <restriction base="string">
          <enumeration value="setting_final_verdict_of_the_test_case." />
          <enumeration value="no_ptcs_were_created." />
        </restriction>
      </simpleType>
    </element>
  </choice>
</complexType>
<complexType name="FinalVerdictInfo">
  <sequence>
    <element name="is_ptc"         type="boolean" />
    <element name="ptc_verdict"    type="TitanLoggerApi:Verdict" />
    <element name="local_verdict"  type="TitanLoggerApi:Verdict" />
    <element name="new_verdict"    type="TitanLoggerApi:Verdict" />
    <element name="verdict_reason" type="string"  minOccurs="0" maxOccurs="1" />
    <element name="ptc_compref"    type="integer" minOccurs="0" maxOccurs="1" />
    <element name="ptc_name"       type="string"  minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>

<simpleType name="Verdict">
  <restriction base="string">
    <!-- Must make sure the lexicographical order matches the severity sort order -->
    <enumeration value="v0none" />
    <enumeration value="v1pass" />
    <enumeration value="v2inconc" />
    <enumeration value="v3fail" />
    <enumeration value="v4error" />
  </restriction>
</simpleType>

<complexType name="DefaultOp">
  <sequence>
    <element name="name" type="string"/>
    <element name="id"   type="integer" />
    <element name="end"  type="TitanLoggerApi:DefaultEnd"/>
  </sequence>
</complexType>

<simpleType name="DefaultEnd">
  <restriction base="string">
    <enumeration value="finish" />
    <enumeration value="repeat" />
    <enumeration value="break" />
  </restriction>
</simpleType>

<simpleType name="PortType">
  <restriction base="string">
    <enumeration value="message">
      <annotation>
        <documentation>MATCHING_M.*</documentation>
      </annotation>
    </enumeration>
    <enumeration value="procedure">
      <annotation>
        <documentation>MATCHING_P.*</documentation>
      </annotation>
    </enumeration>
  </restriction>
</simpleType>

<complexType name="MatchingSuccessType">
  <sequence>
    <element name="port_type" type="TitanLoggerApi:PortType" />
    <element name="port_name" type="string" />
    <element name="info" type="string" />
  </sequence>
</complexType>

<complexType name="MatchingFailureType">
  <sequence>
    <element name="port_type" type="TitanLoggerApi:PortType" />
    <element name="port_name" type="string" />
    <choice>
      <element name="system" type="string" >
        <annotation><documentation>mapped: MATCHING_[PM]M.*</documentation></annotation>
      </element>
      <element name="compref" type="integer" >
        <annotation><documentation>connected: MATCHING_[PM]C.*</documentation></annotation>
      </element>
    </choice>
    <!-- No id if matching failed -->
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="sender_does_not_match_from_clause" />
          <enumeration value="sender_is_not_system" />
          <enumeration value="message_does_not_match_template" />
          <enumeration value="parameters_of_call_do_not_match_template" />
          <enumeration value="parameters_of_reply_do_not_match_template" />
          <enumeration value="exception_does_not_match_template" />
          <enumeration value="not_an_exception_for_signature" />
        </restriction>
      </simpleType>
    </element>
    <element name="info" type="string" />
  </sequence>
</complexType>

<complexType name="MatchingProblemType">
  <sequence>
    <element name="port_name" type="string" />

    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="port_not_started_and_queue_empty" />
          <enumeration value="no_incoming_types" />
          <enumeration value="no_incoming_signatures" />
          <enumeration value="no_outgoing_blocking_signatures" />
          <enumeration value="no_outgoing_blocking_signatures_that_support_exceptions" />
          <enumeration value="component_has_no_ports" />
        </restriction>
      </simpleType>
    </element>

    <element name="operation">
      <simpleType>
        <restriction base="string">
          <enumeration value="receive" />
          <enumeration value="trigger" />
          <enumeration value="getcall" />
          <enumeration value="getreply" />
          <enumeration value="catch" />
          <enumeration value="check" >
            <annotation><documentation>Must be "any port"!</documentation></annotation>
          </enumeration>
        </restriction>
      </simpleType>
    </element>

    <element name="check" type="boolean"/>
    <element name="any_port" type="boolean" />

  </sequence>
</complexType>

<complexType name="MatchingDoneType">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="done_failed._wrong_return_type" />
          <enumeration value="done_failed._no_return" />
          <enumeration value="any_component_done_successful" />
          <enumeration value="any_component_done_failed" />
          <enumeration value="all_component_done_successful" />
          <!--seems to be no "all component.done failed" ?? -->
          <enumeration value="any_component_killed_successful" />
          <enumeration value="any_component_killed_failed" />
          <enumeration value="all_component_killed_successful" />
          <!--seems to be no "all component.killed failed" ?? -->
        </restriction>
      </simpleType>
    </element>
    <element name="type" type="string" />
    <element name="ptc"  type="integer" />
    <element name="return_type" type="string" />
  </sequence>
</complexType>

<complexType name="MatchingTimeout">
  <sequence>
    <element name="timer_name" minOccurs="0" />
  </sequence>
</complexType>

<complexType name="ExecutorRuntime">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <!-- Communications.cc -->
          <enumeration value="connected_to_mc" />
          <enumeration value="disconnected_from_mc" />
          <!-- enumeration value=""/ -->
          <enumeration value="initialization_of_modules_failed" />
          <enumeration value="exit_requested_from_mc_hc" />
          <enumeration value="exit_requested_from_mc_mtc" />
          <enumeration value="stop_was_requested_from_mc_ignored_on_idle_mtc" />
          <enumeration value="stop_was_requested_from_mc" />
          <enumeration value="stop_was_requested_from_mc_ignored_on_idle_ptc" />
          <enumeration value="executing_testcase_in_module" />
          <enumeration value="performing_error_recovery" />
          <!-- Module_list.cc -->
          <enumeration value="initializing_module" />
          <enumeration value="initialization_of_module_finished" />
          <!-- Runtime.cc -->
          <enumeration value="stopping_current_testcase" />
          <enumeration value="exiting" />
          <enumeration value="host_controller_started" /><!--  on hostname -->
          <enumeration value="host_controller_finished" />
          <enumeration value="stopping_control_part_execution" />
          <enumeration value="stopping_test_component_execution" />
          <enumeration value="waiting_for_ptcs_to_finish" />
          <enumeration value="user_paused_waiting_to_resume" />
          <enumeration value="resuming_execution" />
          <enumeration value="terminating_execution" />
          <enumeration value="mtc_created" /><!--  PID %d -->
          <enumeration value="overload_check" />
          <enumeration value="overload_check_fail" />
          <enumeration value="overloaded_no_more" /><!-- PID %d -->
          <!--  Single_main.cc -->
          <enumeration value="executor_start_single_mode" />
          <enumeration value="executor_finish_single_mode" />
          <!--  Snapshot.cc -->
          <enumeration value="fd_limits" /><!-- %d %d -->
        </restriction>
      </simpleType>
    </element>
    <element name="module_name" minOccurs="0" maxOccurs="1" />
    <element name="testcase_name" minOccurs="0" maxOccurs="1" />
    <element name="pid" type="integer" minOccurs="0" maxOccurs="1" />  <!--  reused for max open fd -->
    <element name="fd_setsize" type="integer" minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>

<complexType name="ExecutorUnqualified">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="local_address_was_set" />
          <enumeration value="address_of_mc_was_set" />
          <enumeration value="address_of_control_connection" />
          <enumeration value="host_support_unix_domain_sockets" />

        </restriction>
      </simpleType>
    </element>
    <element name="name" type="string" />
    <element name="addr" type="string" />
    <element name="port" type="integer" />
  </sequence>
</complexType>

<complexType name="ExecutorConfigdata">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="received_from_mc" />
          <enumeration value="processing_failed" />
          <enumeration value="processing_succeeded" />
          <enumeration value="module_has_parameters" /><!-- %s -->
          <enumeration value="using_config_file" /><!-- %s -->
          <enumeration value="overriding_testcase_list" />
        </restriction>
      </simpleType>
    </element>
    <element name="param" type="string" minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>

<complexType name="ExecutorComponent">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="mtc_started" />
          <enumeration value="mtc_finished" />
          <enumeration value="ptc_started" />
          <enumeration value="ptc_finished" />
          <enumeration value="component_init_fail" />
        </restriction>
      </simpleType>
    </element>
    <!-- the logger can get the host name itself
    <element name="host" type="string" />
     -->
    <element name="compref" type="integer" minOccurs="0" maxOccurs="1" />
  </sequence>
</complexType>

<complexType name="ParallelPTC">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="init_component_start" />
          <enumeration value="init_component_finish" />
          <enumeration value="terminating_component" />
          <enumeration value="component_shut_down" />
          <enumeration value="error_idle_ptc" />
          <enumeration value="ptc_created" >
            <annotation><documentation>
            From TTCN_Runtime::create_component, after the create request
            was sent to the MC.
            </documentation></annotation>
          </enumeration>
          <enumeration value="ptc_created_pid">
            <annotation><documentation>
            From TTCN_Runtime::process_create_ptc, after fork in the HC.
            </documentation></annotation>
          </enumeration>
          <enumeration value="function_started" />
          <enumeration value="function_stopped" />
          <enumeration value="function_finished" />
          <enumeration value="function_error" />
          <enumeration value="ptc_done" />
          <enumeration value="ptc_killed" />
          <enumeration value="stopping_mtc" />
          <enumeration value="ptc_stopped" />
          <enumeration value="all_comps_stopped" />
          <enumeration value="ptc_was_killed" />
          <enumeration value="all_comps_killed" />
          <enumeration value="kill_request_frm_mc" />
          <enumeration value="mtc_finished" />
          <enumeration value="ptc_finished" />
          <enumeration value="starting_function" />
        </restriction>
      </simpleType>
    </element>
    <element name="module"   type="string" />
    <element name="name"     type="string" />
    <element name="compref"  type="integer"/>
    <element name="compname"  type="string">
      <annotation><documentation>The component name is usually
      deducible from the component reference. However, there is one case
      when it isn't (before the create operation, when the name is supplied
      as a parameter).</documentation></annotation>
    </element>
    <element name="tc_loc"   type="string">
      <annotation>
        <documentation>doubles as component name</documentation>
      </annotation>
    </element>
    <element name="alive_pid" type="integer"/>
    <element name="status" type="integer"/>
  </sequence>
</complexType>

<complexType name="Parallel">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="creating_new_ptc" />
          <enumeration value="function_stopped" />
          <enumeration value="terminating_test_component_exec" />
          <enumeration value="stopping_ptc" />
          <enumeration value="stop_no_effect" />
          <enumeration value="stopping_all_ptcs" />
          <enumeration value="stop_all_no_effect" />

          <enumeration value="killing_ptc" />
          <enumeration value="kill_no_effect" />
          <enumeration value="killing_all_ptcs" />
          <enumeration value="kill_all_no_effect" />

          <enumeration value="connecting_ports" /><!--  compref & port x2 -->
          <enumeration value="disconnecting_ports" /><!--  compref & port x2 -->
          <enumeration value="mapping_ports" /><!--  compref & port x2 -->
          <enumeration value="unmapping_ports" /><!--  compref & port x2 -->

          <enumeration value="kill_request_from_mc" />
          <enumeration value="killing_component" /><!-- compref & pid -->
          <enumeration value="process_already_terminated" />
          <enumeration value="compref_not_exist" />
        </restriction>
      </simpleType>
    </element>
    <element name="alive" type="boolean" />
    <element name="function_name" type="string" />
    <element name="src_compref" type="integer" />
    <element name="src_port"    type="string" />
    <element name="dst_compref" type="integer" />
    <element name="dst_port"    type="string" />
  </sequence>
</complexType>

<complexType name="StartFunction">
  <sequence>
    <element name="function_name" type="string" />
    <element name="compref" type="integer" />
    <element name="parameter" type="string" minOccurs="0" maxOccurs="unbounded" />
  </sequence>
</complexType>

<complexType name="PTC_exit">
  <annotation><documentation>A complicated case of PARALLEL_PTC</documentation></annotation>
  <sequence>
    <element name="compref"  type="integer" />
    <!-- element name="compname" type="string" /> -->
    <element name="pid" type="integer" />
    <element name="statuscode" type="integer" />
  </sequence>
</complexType>

<complexType name="ParPort">
  <annotation><documentation>For PARALLEL_PORT(CONN|MAP)</documentation></annotation>
  <sequence>
    <element name="operation">
      <simpleType>
        <restriction base="string">
          <enumeration value="connect" />
          <enumeration value="disconnect" />
          <enumeration value="map" />
          <enumeration value="unmap" />
        </restriction>
      </simpleType>
    </element>
    <element name="srcCompref" type="integer"/>
    <element name="dstCompref" type="integer"/>
    <element name="srcPort" />
    <element name="dstPort" />
  </sequence>
</complexType>

<complexType name="Port_Queue">
  <annotation><documentation>Enqueue/dequeue operations
  on both message and procedure ports.</documentation></annotation>
  <sequence>
    <element name="operation">
      <simpleType>
        <restriction base="string">
          <enumeration value="enqueue_msg" />
          <enumeration value="enqueue_call" />
          <enumeration value="enqueue_reply" />
          <enumeration value="enqueue_exception" />
          <enumeration value="extract_msg" />
          <enumeration value="extract_op" />
        </restriction>
      </simpleType>
    </element>
    <element name="port_name" type="string" />
    <element name="compref"   type="integer" />
    <element name="msgid"     type="integer" />
    <element name="address"   type="string" />
    <element name="param"     type="string" />
  </sequence>
</complexType>

<complexType name="Port_State">
  <sequence>
    <element name="operation">
      <simpleType>
        <restriction base="string">
          <enumeration value="started" />
          <enumeration value="stopped" />
          <enumeration value="halted" />
        </restriction>
      </simpleType>
    </element>
    <element name="port_name" type="string" />
  </sequence>
</complexType>

<simpleType name="Port_oper">
  <restriction base="string">
    <enumeration value="call_op" />
    <enumeration value="reply_op" />
    <enumeration value="exception_op" />
  </restriction>
</simpleType>

<complexType name="Proc_port_out">
  <sequence>
    <element name="port_name" type="string" />
    <element name="operation" type="TitanLoggerApi:Port_oper" />
    <element name="compref"   type="integer" />
    <element name="sys_name"  type="string" />
    <element name="parameter" type="string" />
  </sequence>
</complexType>

<complexType name="Proc_port_in">
  <sequence>
    <element name="port_name" type="string" />
    <element name="operation" type="TitanLoggerApi:Port_oper" />
    <element name="compref"   type="integer" />
    <element name="check"     type="boolean" />
    <element name="parameter" type="string" />
    <element name="msgid"     type="integer" />
  </sequence>
</complexType>

<complexType name="Msg_port_recv">
  <sequence>
    <element name="port_name" type="string" />
    <element name="operation">
      <simpleType>
        <restriction base="string">
          <enumeration value="receive_op" />
          <enumeration value="check_receive_op" />
          <enumeration value="trigger_op" />
        </restriction>
      </simpleType>
    </element>
    <element name="compref"   type="integer" />
    <element name="sys_name"  type="string" />
    <element name="parameter" type="string" />
    <element name="msgid"     type="integer" />
  </sequence>
</complexType>

<complexType name="Msg_port_send">
  <sequence>
    <element name="port_name" type="string" />
    <!-- operation is implied: send -->
    <element name="compref"   type="integer" />
    <element name="parameter" type="string" />
  </sequence>
</complexType>

<complexType name="Dualface_mapped">
  <sequence>
    <element name="incoming"    type="boolean" />
    <element name="target_type" type="string" />
    <element name="value"       type="string" />
    <element name="msgid"     type="integer" />
  </sequence>
</complexType>

<complexType name="Dualface_discard">
  <sequence>
    <element name="incoming"    type="boolean" />
    <element name="target_type" type="string" />
    <element name="port_name"   type="string" />
    <element name="unhandled"   type="boolean">
      <annotation><documentation>
      unhandled=true means that there were mappings which failed to handle
      the message; false means that the discard mapping was the only one
      </documentation></annotation>
    </element>
  </sequence>
</complexType>

<complexType name="Setstate">
  <sequence>
    <element name="port_name"   type="string" />
    <element name="state"       type="string" />
    <element name="info"        type="string" />
  </sequence>
</complexType>

<complexType name="Port_Misc">
  <sequence>
    <element name="reason">
      <simpleType>
        <restriction base="string">
          <enumeration value="removing_unterminated_connection" />
          <enumeration value="removing_unterminated_mapping" />
          <enumeration value="port_was_cleared" />
          <enumeration value="local_connection_established" />
          <enumeration value="local_connection_terminated" />
          <enumeration value="port_is_waiting_for_connection_tcp" />
          <enumeration value="port_is_waiting_for_connection_unix" />
          <enumeration value="connection_established" />
          <enumeration value="destroying_unestablished_connection" />
          <enumeration value="terminating_connection" />
          <enumeration value="sending_termination_request_failed" />
          <enumeration value="termination_request_received" />
          <enumeration value="acknowledging_termination_request_failed" />
          <enumeration value="sending_would_block" />
          <enumeration value="connection_accepted" />
          <enumeration value="connection_reset_by_peer" />
          <enumeration value="connection_closed_by_peer" />
          <enumeration value="port_disconnected" />
          <enumeration value="port_was_mapped_to_system" />
          <enumeration value="port_was_unmapped_from_system" />
        </restriction>
      </simpleType>
    </element>
    <element name="port_name" type="string" />
    <element name="remote_component" type="integer" />
    <element name="remote_port" type="string" />
    <element name="ip_address"  type="string" />
    <element name="tcp_port"    type="integer" />
    <element name="new_size"    type="integer" />
  </sequence>
</complexType>

</schema>
