aboutsummaryrefslogtreecommitdiffstats
path: root/fnet/src/vespa/fnet/controlpacket.cpp
blob: e14d5e12f3f0f8029baa267102f77b89435233e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "controlpacket.h"
#include "context.h"
#include <vespa/vespalib/util/stringfmt.h>

#include <vespa/log/log.h>
LOG_SETUP(".fnet.controlpacket");

void
FNET_ControlPacket::Free()
{
}

bool
FNET_ControlPacket::IsRegularPacket()
{
    return false;
}

bool
FNET_ControlPacket::IsControlPacket()
{
    return true;
}

uint32_t
FNET_ControlPacket::GetCommand()
{
    return _command;
}

bool
FNET_ControlPacket::IsChannelLostCMD()
{
    return _command == FNET_CMD_CHANNEL_LOST;
}

bool
FNET_ControlPacket::IsTimeoutCMD()
{
    return _command == FNET_CMD_TIMEOUT;
}

bool
FNET_ControlPacket::IsBadPacketCMD()
{
    return _command == FNET_CMD_BAD_PACKET;
}

uint32_t
FNET_ControlPacket::GetPCODE()
{
    return FNET_NOID;
}

uint32_t
FNET_ControlPacket::GetLength()
{
    return 0;
}

void
FNET_ControlPacket::Encode(FNET_DataBuffer *)
{
    LOG_ABORT("should not be reached");
}

bool
FNET_ControlPacket::Decode(FNET_DataBuffer *, uint32_t)
{
    LOG_ABORT("should not be reached");
}

vespalib::string
FNET_ControlPacket::Print(uint32_t indent)
{
    return vespalib::make_string("%*sFNET_ControlPacket { command = %d }\n",
                                 indent, "", _command);
}

FNET_ControlPacket
FNET_ControlPacket::ChannelLost(FNET_CMD_CHANNEL_LOST);

FNET_ControlPacket
FNET_ControlPacket::IOCAdd(FNET_CMD_IOC_ADD);

FNET_ControlPacket
FNET_ControlPacket::IOCEnableWrite(FNET_CMD_IOC_ENABLE_WRITE);

FNET_ControlPacket
FNET_ControlPacket::IOCHandshakeACT(FNET_CMD_IOC_HANDSHAKE_ACT);

FNET_ControlPacket
FNET_ControlPacket::IOCClose(FNET_CMD_IOC_CLOSE);

FNET_ControlPacket
FNET_ControlPacket::DetachServerAdapterInit(FNET_CMD_DETACH_SERVER_ADAPTER_INIT);

FNET_ControlPacket
FNET_ControlPacket::DetachServerAdapterFini(FNET_CMD_DETACH_SERVER_ADAPTER_FINI);

FNET_ControlPacket
FNET_ControlPacket::Execute(FNET_CMD_EXECUTE);

FNET_ControlPacket
FNET_ControlPacket::Timeout(FNET_CMD_TIMEOUT);

FNET_ControlPacket
FNET_ControlPacket::BadPacket(FNET_CMD_BAD_PACKET);