<commit_before>#pragma once
//=========================================================================//
/*! @file
    @brief  NET 関係構造体 @n
			Copyright 2017 <NAME>
    @author 平松邦仁 (<EMAIL>)
*/
//=========================================================================//
#include <cstdint>
#include <cstring>
#include "common/net_tools.hpp"
#include "common/ip_adrs.hpp"
#include "common/format.hpp"
#include "common/fixed_fifo.hpp"
#include "net2/mac_cash.hpp"

namespace net {

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  ネット共有コンテナ
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	struct net_share {

		typedef utils::fixed_fifo<ip_adrs, 8> MAC_REQUEST;
		MAC_REQUEST		mac_request_;

	};


	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  ネット情報構造体
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	struct net_info {
		uint8_t		mac[6];  ///< イーサーネット、ＭＡＣアドレス（EUI-48）

		ip_adrs		ip;      ///< IP アドレス 
		ip_adrs		mask;    ///< ネット・マスク
		ip_adrs		gw;      ///< ゲートウェイ<commit_msg>add net_state<commit_after>#pragma once
//=========================================================================//
/*! @file
    @brief  NET 関係構造体 @n
			Copyright 2017 <NAME>
    @author 平松邦仁 (<EMAIL>)
*/
//=========================================================================//
#include <cstdint>
#include <cstring>
#include "common/net_tools.hpp"
#include "common/ip_adrs.hpp"
#include "common/format.hpp"
#include "common/fixed_fifo.hpp"
#include "net2/mac_cash.hpp"

namespace net {

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  NET ステート
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	enum class net_state : uint16_t {
		OK,
		FAIL_PORT,      ///< 不正なポート番号
		FAIL_ADRS,      ///< 不正なアドレス
		FAIL_ANY,       ///< クライアントでは、「ANY」は不正
		EVEN_PORT,      ///< 既にそのポート番号は利用されている
		CONTEXT_EMPTY,  ///< コンテキストが無い
	};


	//-----------------------------------------------------------------//
	/*!
		@brief  TCP ステート・メッセージを取得
		@param[in]	state	TCP ステート
		@return TCP ステート・メッセージ
	*/
	//-----------------------------------------------------------------//
	static const char* get_state_str(net_state state)
	{
		switch(state) {
		case net_state::OK:            return "OK";
		case net_state::FAIL_PORT:     return "Fail port";
		case net_state::FAIL_ADRS:     return "Fail ip-address";
		case net_state::FAIL_ANY:      return "Fail any-address";
		case net_state::EVEN_PORT:     return "Error even port";
		case net_state::CONTEXT_EMPTY: return "Context empty";
		default:
			return "";
		}
	}


	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  ネット共有コンテナ
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	struct net_share {

		typedef utils::fixed_fifo<ip_adrs, 8> MAC_REQUEST;
		MAC_REQUEST		mac_request_;

	};


	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  ネット情報構造体
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	struct net_info {
		uint8_t		mac[6];  ///< イーサーネット、ＭＡＣアドレス（EUI-48）

		ip_adrs		ip;      ///< IP アドレス 
		ip_adrs		mask;    ///< ネット・マスク
		ip_adrs		gw;      ///< ゲートウェイ
{'fraction_non_alphanumeric': 0.444044404440444, 'fraction_numerical': 0.006600660066006601, 'mean_word_length': 3.3984168865435356, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 13, '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': '5150923', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1176, 'n_words': 178}