<commit_before>/*
** Copyright (C) 2017  International Business Machines Corporation
** All Rights Reserved
*/

#ifndef DNS_PACKET_FLATTENER_H_
#define DNS_PACKET_FLATTENER_H_

#include <sys/types.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <time.h>
#include <string>
#include <cmath>

#include <SPL/Runtime/Type/SPLType.h>

#include "parse/NetworkHeaderParser.h"
#include "parse/DNSMessageParser.h"



////////////////////////////////////////////////////////////////////////////////
// This class parses DNS fields within a DNS packet
////////////////////////////////////////////////////////////////////////////////

class DNSPacketFlattener {



 private:


  // ?????????????????????????????????

  char* formatTimestamp(const double timestamp, const char* format, char* buffer) {

    struct tm *tmp;
    time_t seconds = (time_t)timestamp;
    tmp = localtime(&seconds);
    size_t length = strftime(buffer, 100, format, tmp);
    sprintf(buffer+length, ".%06d", (int)((timestamp-floor(timestamp))*1000000.0));
    return buffer; }<commit_msg>fix for issue#72<commit_after>/*
** Copyright (C) 2017  International Business Machines Corporation
** All Rights Reserved
*/

#ifndef DNS_PACKET_FLATTENER_H_
#define DNS_PACKET_FLATTENER_H_

#include <sys/types.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <time.h>
#include <string>
#include <cmath>

#include <SPL/Runtime/Type/SPLType.h>

#include "parse/NetworkHeaderParser.h"
#include "parse/DNSMessageParser.h"

#pragma GCC diagnostic ignored "-Wmissing-braces"

////////////////////////////////////////////////////////////////////////////////
// This class parses DNS fields within a DNS packet
////////////////////////////////////////////////////////////////////////////////

class DNSPacketFlattener {



 private:


  // ?????????????????????????????????

  char* formatTimestamp(const double timestamp, const char* format, char* buffer) {

    struct tm *tmp;
    time_t seconds = (time_t)timestamp;
    tmp = localtime(&seconds);
    size_t length = strftime(buffer, 100, format, tmp);
    sprintf(buffer+length, ".%06d", (int)((timestamp-floor(timestamp))*1000000.0));
    return buffer; }
{'fraction_non_alphanumeric': 0.279090113735783, 'fraction_numerical': 0.015748031496062992, 'mean_word_length': 2.4916030534351146, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3226523', 'n_tokens_mistral': 713, 'n_tokens_neox': 652, 'n_words': 165}