<commit_before>#ifndef _VEE_NET_H_
#define _VEE_NET_H_

#include <vee/stream.h>
#include <vee/platform.h>

namespace vee {
   
namespace net {

using port_t = unsigned short;
#if VEE_PLATFORM_X32
using socketfd_t = uint32_t;
#elif VEE_PLATFORM_X64
using socketfd_t = uint64_t;
#endif // VEE_PLATFORM

// Forward declaration
class net_stream;

using session_t = ::std::shared_ptr<net_stream>;

struct async_connect_info
{
    using shared_ptr = ::std::shared_ptr<async_connect_info>;
    bool is_success;
    session_t session;
};

class net_stream abstract: public io_stream
{
public:
    using this_t = net_stream;
    using ref_t  = this_t&;
    using rref_t = this_t&&;
    using shared_ptr = ::std::shared_ptr<this_t>;
    using unique_ptr = ::std::unique_ptr<this_t>;
    using async_connect_delegate = delegate<void(async_connect_info::shared_ptr)>;
    virtual ~net_stream() = default;
    virtual void connect(const char* ip, port_t port) __PURE;
    virtual void disconnect() __PURE;
    virtual void async_connect(async_connect_delegate::shared_ptr info) __noexcept __PURE;
    virtual socketfd_t native() __noexcept __PURE;
};

namespace tcp {

struct async_accept_info
{
    using shared_ptr = ::std::shared_ptr<async_accept_info>;
    bool is_success;
    session_t session;
};

class server abstract
{
public:
    using this_t = server;
    using ref_t = this_t&;
    using rref_t = this_t&&;
    using shared_ptr = ::std::shared_ptr<this_t>;
    using unique_ptr = ::std::unique_ptr<this_t>;
    using async_accept_delegate = delegate<void(async_accept_info::shared_ptr)>;
    virtual ~server() = default;
    virtual void open() __PURE;
    virtual void close() __PURE;
    virtual ::std::pair<bool, session_t> accept() __PURE;
    virtual void async_accept(async_accept_delegate::shared_ptr e);
};

} // !namespace tcp
    
} // !namespace net

} // !namespace vee<commit_msg>Added APIs of each network protocols<commit_after>#ifndef _VEE_NET_H_
#define _VEE_NET_H_

#include <vee/stream.h>
#include <vee/platform.h>

namespace vee {
   
namespace net {

using port_t = unsigned short;
#if VEE_PLATFORM_X32
using socketfd_t = uint32_t;
#elif VEE_PLATFORM_X64
using socketfd_t = uint64_t;
#endif // VEE_PLATFORM

// Forward declaration
class net_stream;

using session_t = ::std::shared_ptr<net_stream>;

struct async_connect_info
{
    using shared_ptr = ::std::shared_ptr<async_connect_info>;
    bool is_success;
    session_t session;
};

class net_stream abstract: public io_stream
{
public:
    using this_t = net_stream;
    using ref_t  = this_t&;
    using rref_t = this_t&&;
    using shared_ptr = ::std::shared_ptr<this_t>;
    using unique_ptr = ::std::unique_ptr<this_t>;
    using async_connect_delegate = delegate<void(async_connect_info::shared_ptr)>;
    virtual ~net_stream() = default;
    virtual void connect(const char* ip, port_t port) __PURE;
    virtual void disconnect() __PURE;
    virtual void async_connect(async_connect_delegate::shared_ptr info) __noexcept __PURE;
    virtual socketfd_t native() __noexcept __PURE;
};

namespace tcp {

struct async_accept_info
{
    using shared_ptr = ::std::shared_ptr<async_accept_info>;
    bool is_success;
    session_t session;
};

class server abstract
{
public:
    using this_t = server;
    using ref_t = this_t&;
    using rref_t = this_t&&;
    using shared_ptr = ::std::shared_ptr<this_t>;
    using unique_ptr = ::std::unique_ptr<this_t>;
    using async_accept_delegate = delegate<void(async_accept_info::shared_ptr)>;
    virtual ~server() = default;
    virtual void open() __PURE;
    virtual void close() __PURE;
    virtual ::std::pair<bool, session_t> accept() __PURE;
    virtual void async_accept(async_accept_delegate::shared_ptr callback) __PURE;
};

session_t create_session();
server::shared_ptr create_server(port_t port);

} // !namespace tcp
    
namespace udp {

session_t create_stream();

} // !namespace udp

namespace rfc6455 {

session_t create_session();
tcp::server::shared_ptr create_server(port_t port);

} // !namespace rfc6455

} // !namespace net

} // !namespace vee
{'fraction_non_alphanumeric': 0.10532746823069404, 'fraction_numerical': 0.005865102639296188, 'mean_word_length': 4.6689750692520775, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '7403909', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1404, 'n_words': 331}