Commit 5babbea3 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add Linux link layer (Linux Wireshark captures)

parent 42acd249
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -389,6 +389,14 @@ public:
   */
  std::vector<uint8_t> base64_to_buffer(const std::vector<uint8_t> &p_value, const bool p_remove_crlf = true);

  /*!
   * \brief Split a string line by line
   * \param[in] p_input The buffer value
   * \return The lines list
   */
  std::vector<std::string> split_lines(const std::string& p_input);


  static const std::string lut_u;
  static const std::string lut_l;
  static const std::string base64_enc_map[2];
+14 −0
Original line number Diff line number Diff line
@@ -268,3 +268,17 @@ std::vector<uint8_t> converter::base64_to_buffer(const std::vector<uint8_t> &p_v

  return out;
}

#include <string>
#include <string_view>
#include <vector>

std::vector<std::string> converter::split_lines(const std::string& p_input) {
    std::vector<std::string> lines;
    std::istringstream stream(p_input);
    std::string line;
    while (std::getline(stream, line)) {
        lines.push_back(line);
    }
    return lines;
}
+3 −3
Original line number Diff line number Diff line
/*!
 * \file      udp_layer.hh
 * \brief     Header file for ITS UDP/IP protocol layer definition.
 * \author    ETSI STF525
 * \file      ethernet_layer.hh
 * \brief     Header file for Ethernet protocol layer definition.
 * \author    ETSI TTF T048
 * \copyright ETSI Copyright Notification
 *            No part may be reproduced except as authorized by written permission.
 *            The copyright and the foregoing restriction extend to reproduction in all media.
+1 −1
Original line number Diff line number Diff line
@@ -659,7 +659,7 @@ int http_codec::decode_body(TTCN_Buffer &decoding_buffer, LibHttp__MessageBodyTy
      LibHttp__XmlMessageBodyTypes::XmlBody xml_body;
      decode_body_xml(body, xml_body, p_content_type, &p);
      message_body.xml__body() = xml_body;
    } else if (p["decode_str"].find("<html>") != std::string::npos) { // Try to identify HTML
    } else if (p["decode_str"].find("<html") != std::string::npos) { // Try to identify HTML
      loggers::get_instance().log("http_codec::decode_body: Find html message");
      LibHttp__MessageBodyTypes::HtmlBody html_body;
      decode_body_html(body, html_body, p_content_type, &p);
+26 −0
Original line number Diff line number Diff line
#include "linux_frame_layer_factory.hh"

#include "loggers.hh"

linux_frame_layer::linux_frame_layer(const std::string&  p_type, const std::string&  p_param) : layer(p_type), _params() {
  loggers::get_instance().log(">>> linux_frame_layer::linux_frame_layer: '%s', %s", to_string().c_str(), p_param.c_str());

}

void linux_frame_layer::send_data(OCTETSTRING& p_data, params& p_params) {
  loggers::get_instance().log_msg(">>> linux_frame_layer::send_data: ", p_data);

  send_to_all_layers(p_data, static_cast<params&>(p_params));
}

void linux_frame_layer::receive_data(OCTETSTRING& p_data, params& p_params) {
  loggers::get_instance().log_msg(">>> linux_frame_layer::receive_data: ", p_data);

  // 080000000000000400010406fa163ee964230000
  OCTETSTRING data = OCTETSTRING(p_data.lengthof() - 20, 20 + static_cast<const uint8_t *>(p_data));
  //loggers::get_instance().log_msg("linux_frame_layer::receive_data: payload for upper layer:", data);

  receive_to_all_layers(data, static_cast<params&>(p_params));
}

linux_frame_layer_factory linux_frame_layer_factory::_f;
Loading