blob: 25c2fa9c3476dd25694c81b64818c7b1a800c703 [file] [log] [blame]
Michael Tang0f553bd2017-06-16 17:38:45 -07001syntax = "proto2";
2
3// The types of message notification sent from Moblab.
4enum MessageType {
Michael Tange8bc9592017-07-06 10:59:32 -07005 MSG_UNKNOWN = 0;
6 MSG_MOBLAB_HEARTBEAT = 1;
7 MSG_MOBLAB_REMOTE_EVENT = 2;
8 MSG_MOBLAB_ALERT = 3;
Michael Tang0f553bd2017-06-16 17:38:45 -07009}
10
Michael Tange8bc9592017-07-06 10:59:32 -070011// The common pubsub notification attribute names.
12enum MessageAttribute {
13 ATTR_INVALID = 0;
14 ATTR_MESSAGE_TYPE = 1;
15 ATTR_MESSAGE_VERSION = 2;
16 ATTR_MOBLAB_MAC_ADDRESS = 3;
17 ATTR_MOBLAB_ID = 4;
18}
19
20// Timestamp is not defined in proto2. We need to define it by ourselves.
21// It represents a point in time independent of any time zone
22// or calendar, represented as seconds and fractions of seconds at
23// nanosecond resolution.
24// Clone from https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto.
Michael Tang0f553bd2017-06-16 17:38:45 -070025message Timestamp {
Michael Tange8bc9592017-07-06 10:59:32 -070026 optional int64 seconds = 1;
27 // Non-negative fractions of a second at nanosecond resolution.
Michael Tang0f553bd2017-06-16 17:38:45 -070028 optional int64 nanos = 2 [default = 0];
29}
30
Michael Tang0f553bd2017-06-16 17:38:45 -070031message Heartbeat {
32 optional Timestamp timestamp = 1;
33}
34
35// The remote event notification message.
36message RemoteEventMessage {
37 // EventType is an enumeration of event types sent to cloud console.
38 // Any new event type should be added here.
Michael Tange8bc9592017-07-06 10:59:32 -070039 enum Type {
40 EVENT_UNKNOWN = 0;
41 EVENT_MOBLAB_BOOT_COMPLETE = 1;
Michael Tang0f553bd2017-06-16 17:38:45 -070042 }
43
Michael Tange8bc9592017-07-06 10:59:32 -070044 optional Type type = 1 [default = EVENT_UNKNOWN];
45 optional string data = 2;
Michael Tang0f553bd2017-06-16 17:38:45 -070046}
47
48// Moblab alerts
49message Alert {
50 enum AlertLevel {
Michael Tange8bc9592017-07-06 10:59:32 -070051 ALERT_UNSPECIFIED = 0;
52 ALERT_CRITICAL = 1;
53 ALERT_MAJOR = 2;
54 ALERT_MINOR = 3;
Michael Tang0f553bd2017-06-16 17:38:45 -070055 }
Michael Tange8bc9592017-07-06 10:59:32 -070056 optional AlertLevel level = 1;
Michael Tang0f553bd2017-06-16 17:38:45 -070057 optional string data = 2;
58 optional Timestamp timestamp = 3;
59 optional string source_application = 4;
60 optional string source_component = 5;
61}