Commit fc567794 authored by YannGarcia's avatar YannGarcia
Browse files

Add XML canonicalization in xml_codec

parent da0da9ba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin

sources     := $(sort $(all_sources))
includes    := $(outdir) $(outdir)/.. $(all_includes) $(NPCAP_INCLUDE)
includes    := $(outdir) $(outdir)/.. $(all_includes) /usr/include/libxml2 $(NPCAP_INCLUDE)

ifeq (Windows_NT,$(OS))
  EXE=.exe
@@ -123,7 +123,7 @@ $(cc_objects) : $(outdir)/%.o : %.cc
$(gen_sources): $(outdir)/.generate

$(outdir)/.generate: Makefile $(tt_sources)
	$(TTCN3_DIR)/bin/compiler -b -d -e -f -g -j -l -L -M -O -R -U none -x -o $(outdir) $(tt_sources)
	$(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o $(outdir) $(tt_sources)
	touch $@

$(foreach S, $(ttcn_sources),  $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc,  $(S))): $(S)))
+12 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
#include "xml_codec_factory.hh"

#include "loggers.hh"
#include "xml_converters.hh"

#include "LibHttp_XmlMessageBodyTypes.hh"

@@ -30,7 +31,16 @@ int xml_codec::encode(const LibHttp__XmlMessageBodyTypes::XmlBody& msg, OCTETSTR
    loggers::get_instance().warning("xml_codec::encode: Unsupported variant");
    return -1;
  }

  // Canonicalization of the XML document
  const std::string to_canonical(static_cast<const char*>((const char*)encoding_buffer.get_data()), encoding_buffer.get_len() + static_cast<const char*>((const char*)encoding_buffer.get_data()));
  std::string canonicalized;
  if (xml_converters::get_instance().xml_canonicalization(to_canonical, canonicalized) == -1) {
    data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
  } else {
    data = OCTETSTRING(canonicalized.length(), (const unsigned char*)canonicalized.c_str());
  }

  { // TITAN issue: variant "namespace as 'http:www:cise:eu:servicemodel:v1:message' prefix 'ns4'" seems buggy
    std::string s(static_cast<const unsigned char*>(data), data.lengthof() + static_cast<const unsigned char*>(data));
    size_t idx = 0;
@@ -43,6 +53,7 @@ int xml_codec::encode(const LibHttp__XmlMessageBodyTypes::XmlBody& msg, OCTETSTR

    data = OCTETSTRING(s.length(), (const unsigned char*)s.c_str());
  }

  loggers::get_instance().log_msg("xml_codec::encode: After encoding: ", data);

  loggers::get_instance().log("<<< xml_codec::encode");
+2 −1
Original line number Diff line number Diff line
#TTCN3_DIR      := /cygdrive/c/Tools/Titan
TTCN3_COMPILER_OPTIONS := -b -d -e -f -g -j -l -L -M -O -R -U none -x
#TTCN3_DIR      := /cygdrive/c/Tools/Titan
#WPCAP_DLL_PATH := /cygdrive/c/windows/system32/npcap/wpcap.dll
#NPCAP_INCLUDE  := /cygdrive/c/PROGRA~1/Npcap/sdk/include
T3Q_PATH=./tools/t3q-v2.0.0b30
+2 −2
Original line number Diff line number Diff line
@@ -62,9 +62,9 @@ system.httpPort_notif.params := "HTTP(codecs=xml:xml_codec)/TCP(debug=1,server_m
#AtsCise_TestControl.control

# Check that the IUT sends a PullResponse when recieving a PullRequest with no Acknowledgement
#AtsCise_TestCases.TC_CISE_xxx_BV_01
AtsCise_TestCases.TC_CISE_xxx_BV_01
# Check that the IUT is requested to send a PullRequest with no Acknowledgement, the IUT sends a PullRequest with entry Acknowledgement set to False
AtsCise_TestCases.TC_CISE_yyy_BV_01
#AtsCise_TestCases.TC_CISE_yyy_BV_01

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
Original line number Diff line number Diff line
Subproject commit bafc335bf71b976a49fb9edd4237fc517d872834
Subproject commit 683ea737b145b03518cbe462485fe7bee3a858b6
Loading