载入中...
搜索中...
未找到
NetTypes.h
浏览该文件的文档.
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <string>
6#include <vector>
7
8namespace eve::network {
9
11constexpr size_t kMaxSendBuffer = 1024 * 1024;
13constexpr size_t kMaxFrameSize = 1024 * 1024;
14
16enum class NetKind { Tcp, Udp, Http, Channel };
17
19enum class NetEvType {
20 Conn,
21 Data,
22 Err,
24 ChMsg,
26};
27
36 void* handle = nullptr; // TcpSocket* / UdpSocket* / HttpRequest* / Channel*
37 std::shared_ptr<std::vector<char>> bytes;
38 std::string peer;
39 std::string reason;
40 int status = 0;
41};
42
43} // namespace eve::network
Length-prefixed (big-endian uint32) message framing over a TcpSocket. sendMsg() writes one framed mes...
Definition Channel.h:21
NetKind
Which transport produced a completion.
Definition NetTypes.h:16
constexpr size_t kMaxFrameSize
Maximum framed message size for Channel (1 MiB).
Definition NetTypes.h:13
NetEvType
Completion event type delivered through Network::pump.
Definition NetTypes.h:19
constexpr size_t kMaxSendBuffer
Maximum outgoing send buffer size per socket (1 MiB).
Definition NetTypes.h:11
One asynchronous network result/event. handle points at the originating TcpSocket/UdpSocket/HttpReque...
Definition NetTypes.h:33
std::shared_ptr< std::vector< char > > bytes
Definition NetTypes.h:37