-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchlorobot_rpc.proto
83 lines (68 loc) · 2.01 KB
/
chlorobot_rpc.proto
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
syntax = "proto3";
// A Chlorobot IRC RPC interface
service ChlorobotRPC {
// Listens in on the IRC interface
//
// Streams parsed IRC packets
rpc Listen(ChlorobotAuthentication) returns (stream ChlorobotPacket) {}
// Sends a packet to the IRC interface
//
// Must send authentication data for security
// Returns an acknowledgement token indicating if it was successful
rpc Send(ChlorobotRequest) returns (ChlorobotAcknowledgement) {}
}
// A parsed IRC packet (SEE: IETF RFC 1459)
message ChlorobotPacket {
// The prefix field as stated in the RFC
optional string prefix_0 = 1;
optional bytes prefix = 6;
// The second field as stated in the RFC
oneof command {
// A non-numeric string command
bytes non_numeric = 7;
string non_numeric_0 = 2;
// An IRC numeric (encoded: 001 from IRC is 1, 011 is 11, 111 is 111)
uint32 numeric = 3;
}
// Parameters separated by spaces
repeated bytes parameters = 8;
repeated string parameters_0 = 4;
// The last parameter, not separated by spaces
optional bytes trailing_parameter = 9;
optional string trailing_parameter_0 = 5;
}
// An authenticated data packet with data to send to IRC
message ChlorobotRequest {
// Authentication data
ChlorobotAuthentication auth = 1;
// An encoded IRC packet or command flag
oneof data {
ChlorobotPacket packet = 2;
ChlorobotCommandEnum command_type = 3;
}
}
// An authentication data packet to log into the RPC
message ChlorobotAuthentication {
// A token to log into the RPC
optional string token = 1;
// If not present, parse the UTF8 fields
// If present: 1 -> parse the bytes fields
optional uint32 version = 2;
}
enum ChlorobotCommandEnum {
SEND_NOTHING = 0;
SEND_VERSION = 1;
SEND_QUIT = 2;
}
// SemVer compliant version response
message ChlorobotVersion {
uint32 major = 1;
uint32 minor = 2;
uint32 patch = 3;
// A pretty version information
string pretty = 4;
}
// A request send success acknowledgement, might be useful in the future
message ChlorobotAcknowledgement {
optional ChlorobotVersion version = 1;
}