<commit_before>/*
 * Copyright (C) 2021 Freie Universität Berlin
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @defgroup    net_dns_msg DNS message parser and composer
 * @ingroup     net_dns
 * @brief       Parsing and composition of DNS messages
 * @{
 *
 * @file
 * @brief       Definitions for parsing and composition of DNS messages
 *
 * @author  <NAME> <<EMAIL>>
 */
#ifndef NET_DNS_MSG_H
#define NET_DNS_MSG_H

#include <stdint.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup net_dns_msg_conf DNS message parsing and composition configuration
 * @ingroup  config
 * @{
 */
/**
 * @brief   maximum DNS message length
 */
#ifndef CONFIG_DNS_MSG_LEN
#define CONFIG_DNS_MSG_LEN         (128U)
#endif  /* CONFIG_DNS_MSG_LEN */
/** @} */

/**
 * @brief DNS internal structure
 *
 * @see [RFC 1035, section 4.1.1](https://tools.ietf.org/html/rfc1035#section-4.1.1)
 */
typedef struct {
    uint16_t id;        /**< identifier */
    /**
     * @brief   flags
     *
     *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     *     |QR|   Opcode  |AA|TC|RD|RA|Z |AD|CD|   RCODE   |
     *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     *
     * - QR: Query (0) or Response (1)
     * - Opcode: Kind of query
     * - AA: Authoritative Answer
     * - TC: Truncated
     * - RD: Recursion Desired
     * - RA: Recursion Available
     * - Z: Reserved
     * - AD: Authentic Data (see [RFC 4035](https://tools.ietf.org/html/4035))
     * - CD: Checking Disabled (see [RFC 4035](https://tools.ietf.org/html/4035))
     * - RCODE: Response Code
     */
    uint16_t flags;<commit_msg>sys/net/dns: mark dns_hdr_t as packed<commit_after>/*
 * Copyright (C) 2021 Freie Universität Berlin
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @defgroup    net_dns_msg DNS message parser and composer
 * @ingroup     net_dns
 * @brief       Parsing and composition of DNS messages
 * @{
 *
 * @file
 * @brief       Definitions for parsing and composition of DNS messages
 *
 * @author  <NAME> <<EMAIL>>
 */
#ifndef NET_DNS_MSG_H
#define NET_DNS_MSG_H

#include <stdint.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup net_dns_msg_conf DNS message parsing and composition configuration
 * @ingroup  config
 * @{
 */
/**
 * @brief   maximum DNS message length
 */
#ifndef CONFIG_DNS_MSG_LEN
#define CONFIG_DNS_MSG_LEN         (128U)
#endif  /* CONFIG_DNS_MSG_LEN */
/** @} */

/**
 * @brief DNS internal structure
 *
 * @see [RFC 1035, section 4.1.1](https://tools.ietf.org/html/rfc1035#section-4.1.1)
 */
typedef struct __attribute__((packed)) {
    uint16_t id;        /**< identifier */
    /**
     * @brief   flags
     *
     *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     *     |QR|   Opcode  |AA|TC|RD|RA|Z |AD|CD|   RCODE   |
     *     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     *
     * - QR: Query (0) or Response (1)
     * - Opcode: Kind of query
     * - AA: Authoritative Answer
     * - TC: Truncated
     * - RD: Recursion Desired
     * - RA: Recursion Available
     * - Z: Reserved
     * - AD: Authentic Data (see [RFC 4035](https://tools.ietf.org/html/4035))
     * - CD: Checking Disabled (see [RFC 4035](https://tools.ietf.org/html/4035))
     * - RCODE: Response Code
     */
    uint16_t flags;
{'fraction_non_alphanumeric': 0.1762249443207127, 'fraction_numerical': 0.02505567928730512, 'mean_word_length': 2.302389705882353, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 6, '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': '4521884', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1308, 'n_words': 326}