From ac05f1f5484a68fdd4309f9643cfb0a3b2fb9ddd Mon Sep 17 00:00:00 2001 From: or-else Date: Fri, 27 Oct 2017 12:50:19 -0700 Subject: [PATCH] actually adding cmbined proto files and generated go --- pbx/README.md | 8 + pbx/model.pb.go | 2622 +++++++++++++++++++++++++++++++++++++++++++++++ pbx/model.proto | 384 +++++++ 3 files changed, 3014 insertions(+) create mode 100644 pbx/README.md create mode 100644 pbx/model.pb.go create mode 100644 pbx/model.proto diff --git a/pbx/README.md b/pbx/README.md new file mode 100644 index 000000000..72fb4639b --- /dev/null +++ b/pbx/README.md @@ -0,0 +1,8 @@ +# Protocol Buffer and gRPC definitions + +`datamodel.proto`: [Protocol buffer](https://developers.google.com/protocol-buffers/) definitions of client and server messages +`client.proto`: [gRPC](https://grpc.io/) service definition for implmenting clients +`plugin.proto`: gRPC service definition for implementing plugins + + + diff --git a/pbx/model.pb.go b/pbx/model.pb.go new file mode 100644 index 000000000..4368bef11 --- /dev/null +++ b/pbx/model.pb.go @@ -0,0 +1,2622 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: model.proto + +/* +Package pbx is a generated protocol buffer package. + +It is generated from these files: + model.proto + +It has these top-level messages: + DefaultAcsMode + AccessMode + SetSub + SetDesc + GetOpts + BrowseOpts + GetQuery + SetQuery + ClientHi + ClientAcc + ClientLogin + ClientSub + ClientLeave + ClientPub + ClientGet + ClientSet + ClientDel + ClientNote + ClientMsg + TopicDesc + TopicSub + ServerCtrl + ServerData + ServerPres + ServerMeta + ServerInfo + ServerMsg + Session + Topic + User + ClientReq +*/ +package pbx + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type InfoNote int32 + +const ( + InfoNote_READ InfoNote = 0 + InfoNote_RECV InfoNote = 1 + InfoNote_KP InfoNote = 2 +) + +var InfoNote_name = map[int32]string{ + 0: "READ", + 1: "RECV", + 2: "KP", +} +var InfoNote_value = map[string]int32{ + "READ": 0, + "RECV": 1, + "KP": 2, +} + +func (x InfoNote) String() string { + return proto.EnumName(InfoNote_name, int32(x)) +} +func (InfoNote) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// What to delete, either "msg" to delete messages (default) or "topic" to delete the topic or "sub" +// to delete a subscription to topic. +type ClientDel_What int32 + +const ( + ClientDel_MSG ClientDel_What = 0 + ClientDel_TOPIC ClientDel_What = 1 + ClientDel_SUB ClientDel_What = 2 +) + +var ClientDel_What_name = map[int32]string{ + 0: "MSG", + 1: "TOPIC", + 2: "SUB", +} +var ClientDel_What_value = map[string]int32{ + "MSG": 0, + "TOPIC": 1, + "SUB": 2, +} + +func (x ClientDel_What) String() string { + return proto.EnumName(ClientDel_What_name, int32(x)) +} +func (ClientDel_What) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{16, 0} } + +type ServerPres_What int32 + +const ( + ServerPres_ON ServerPres_What = 0 + ServerPres_OFF ServerPres_What = 1 + ServerPres_UA ServerPres_What = 3 + ServerPres_UPD ServerPres_What = 4 + ServerPres_GONE ServerPres_What = 5 + ServerPres_ACS ServerPres_What = 6 + ServerPres_TERM ServerPres_What = 7 + ServerPres_MSG ServerPres_What = 8 + ServerPres_READ ServerPres_What = 9 + ServerPres_RECV ServerPres_What = 10 + ServerPres_DEL ServerPres_What = 11 +) + +var ServerPres_What_name = map[int32]string{ + 0: "ON", + 1: "OFF", + 3: "UA", + 4: "UPD", + 5: "GONE", + 6: "ACS", + 7: "TERM", + 8: "MSG", + 9: "READ", + 10: "RECV", + 11: "DEL", +} +var ServerPres_What_value = map[string]int32{ + "ON": 0, + "OFF": 1, + "UA": 3, + "UPD": 4, + "GONE": 5, + "ACS": 6, + "TERM": 7, + "MSG": 8, + "READ": 9, + "RECV": 10, + "DEL": 11, +} + +func (x ServerPres_What) String() string { + return proto.EnumName(ServerPres_What_name, int32(x)) +} +func (ServerPres_What) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{23, 0} } + +type Session_AuthLevel int32 + +const ( + Session_NONE Session_AuthLevel = 0 + Session_ANON Session_AuthLevel = 10 + Session_AUTH Session_AuthLevel = 20 + Session_ROOT Session_AuthLevel = 30 +) + +var Session_AuthLevel_name = map[int32]string{ + 0: "NONE", + 10: "ANON", + 20: "AUTH", + 30: "ROOT", +} +var Session_AuthLevel_value = map[string]int32{ + "NONE": 0, + "ANON": 10, + "AUTH": 20, + "ROOT": 30, +} + +func (x Session_AuthLevel) String() string { + return proto.EnumName(Session_AuthLevel_name, int32(x)) +} +func (Session_AuthLevel) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{27, 0} } + +// Topic default access mode +type DefaultAcsMode struct { + Auth string `protobuf:"bytes,1,opt,name=auth" json:"auth,omitempty"` + Anon string `protobuf:"bytes,2,opt,name=anon" json:"anon,omitempty"` +} + +func (m *DefaultAcsMode) Reset() { *m = DefaultAcsMode{} } +func (m *DefaultAcsMode) String() string { return proto.CompactTextString(m) } +func (*DefaultAcsMode) ProtoMessage() {} +func (*DefaultAcsMode) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *DefaultAcsMode) GetAuth() string { + if m != nil { + return m.Auth + } + return "" +} + +func (m *DefaultAcsMode) GetAnon() string { + if m != nil { + return m.Anon + } + return "" +} + +// Actual access mode +type AccessMode struct { + // Access mode requested by the user + Want string `protobuf:"bytes,1,opt,name=want" json:"want,omitempty"` + // Access mode granted to the user by the admin + Given string `protobuf:"bytes,2,opt,name=given" json:"given,omitempty"` +} + +func (m *AccessMode) Reset() { *m = AccessMode{} } +func (m *AccessMode) String() string { return proto.CompactTextString(m) } +func (*AccessMode) ProtoMessage() {} +func (*AccessMode) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *AccessMode) GetWant() string { + if m != nil { + return m.Want + } + return "" +} + +func (m *AccessMode) GetGiven() string { + if m != nil { + return m.Given + } + return "" +} + +// SetSub: payload in set.sub request to update current subscription or invite another user, {sub.what} == "sub" +type SetSub struct { + // User affected by this request. Default (empty): current user + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + // Access mode change, either Given or Want depending on context + Mode string `protobuf:"bytes,2,opt,name=mode" json:"mode,omitempty"` +} + +func (m *SetSub) Reset() { *m = SetSub{} } +func (m *SetSub) String() string { return proto.CompactTextString(m) } +func (*SetSub) ProtoMessage() {} +func (*SetSub) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *SetSub) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *SetSub) GetMode() string { + if m != nil { + return m.Mode + } + return "" +} + +// SetDesc: C2S in set.what == "desc" and sub.init message +type SetDesc struct { + DefaultAcs *DefaultAcsMode `protobuf:"bytes,1,opt,name=default_acs,json=defaultAcs" json:"default_acs,omitempty"` + Public []byte `protobuf:"bytes,2,opt,name=public,proto3" json:"public,omitempty"` + Private []byte `protobuf:"bytes,3,opt,name=private,proto3" json:"private,omitempty"` +} + +func (m *SetDesc) Reset() { *m = SetDesc{} } +func (m *SetDesc) String() string { return proto.CompactTextString(m) } +func (*SetDesc) ProtoMessage() {} +func (*SetDesc) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *SetDesc) GetDefaultAcs() *DefaultAcsMode { + if m != nil { + return m.DefaultAcs + } + return nil +} + +func (m *SetDesc) GetPublic() []byte { + if m != nil { + return m.Public + } + return nil +} + +func (m *SetDesc) GetPrivate() []byte { + if m != nil { + return m.Private + } + return nil +} + +type GetOpts struct { + IfModifiedSince int64 `protobuf:"varint,1,opt,name=if_modified_since,json=ifModifiedSince" json:"if_modified_since,omitempty"` + Limit int32 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` +} + +func (m *GetOpts) Reset() { *m = GetOpts{} } +func (m *GetOpts) String() string { return proto.CompactTextString(m) } +func (*GetOpts) ProtoMessage() {} +func (*GetOpts) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *GetOpts) GetIfModifiedSince() int64 { + if m != nil { + return m.IfModifiedSince + } + return 0 +} + +func (m *GetOpts) GetLimit() int32 { + if m != nil { + return m.Limit + } + return 0 +} + +type BrowseOpts struct { + // Load messages with seq id equal or greater than this + SinceId int32 `protobuf:"varint,1,opt,name=since_id,json=sinceId" json:"since_id,omitempty"` + // Load messages with UpdatedAt equal or grater than this + SinceTs int64 `protobuf:"varint,2,opt,name=since_ts,json=sinceTs" json:"since_ts,omitempty"` + // Load messages with seq id lower than this + BeforeId int32 `protobuf:"varint,3,opt,name=before_id,json=beforeId" json:"before_id,omitempty"` + // Load messages with UpdatedAt lower than this + BeforeTs int64 `protobuf:"varint,4,opt,name=before_ts,json=beforeTs" json:"before_ts,omitempty"` + // Limit the number of messages loaded + Limit int32 `protobuf:"varint,5,opt,name=limit" json:"limit,omitempty"` +} + +func (m *BrowseOpts) Reset() { *m = BrowseOpts{} } +func (m *BrowseOpts) String() string { return proto.CompactTextString(m) } +func (*BrowseOpts) ProtoMessage() {} +func (*BrowseOpts) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *BrowseOpts) GetSinceId() int32 { + if m != nil { + return m.SinceId + } + return 0 +} + +func (m *BrowseOpts) GetSinceTs() int64 { + if m != nil { + return m.SinceTs + } + return 0 +} + +func (m *BrowseOpts) GetBeforeId() int32 { + if m != nil { + return m.BeforeId + } + return 0 +} + +func (m *BrowseOpts) GetBeforeTs() int64 { + if m != nil { + return m.BeforeTs + } + return 0 +} + +func (m *BrowseOpts) GetLimit() int32 { + if m != nil { + return m.Limit + } + return 0 +} + +type GetQuery struct { + What string `protobuf:"bytes,1,opt,name=what" json:"what,omitempty"` + // Parameters of "desc" request + Desc *GetOpts `protobuf:"bytes,2,opt,name=desc" json:"desc,omitempty"` + // Parameters of "sub" request + Sub *GetOpts `protobuf:"bytes,3,opt,name=sub" json:"sub,omitempty"` + // Parameters of "data" request + Data *BrowseOpts `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"` +} + +func (m *GetQuery) Reset() { *m = GetQuery{} } +func (m *GetQuery) String() string { return proto.CompactTextString(m) } +func (*GetQuery) ProtoMessage() {} +func (*GetQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *GetQuery) GetWhat() string { + if m != nil { + return m.What + } + return "" +} + +func (m *GetQuery) GetDesc() *GetOpts { + if m != nil { + return m.Desc + } + return nil +} + +func (m *GetQuery) GetSub() *GetOpts { + if m != nil { + return m.Sub + } + return nil +} + +func (m *GetQuery) GetData() *BrowseOpts { + if m != nil { + return m.Data + } + return nil +} + +type SetQuery struct { + // Topic metadata, new topic & new subscriptions only + Desc *SetDesc `protobuf:"bytes,1,opt,name=desc" json:"desc,omitempty"` + // Subscription parameters + Sub *SetSub `protobuf:"bytes,2,opt,name=sub" json:"sub,omitempty"` +} + +func (m *SetQuery) Reset() { *m = SetQuery{} } +func (m *SetQuery) String() string { return proto.CompactTextString(m) } +func (*SetQuery) ProtoMessage() {} +func (*SetQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *SetQuery) GetDesc() *SetDesc { + if m != nil { + return m.Desc + } + return nil +} + +func (m *SetQuery) GetSub() *SetSub { + if m != nil { + return m.Sub + } + return nil +} + +// Client handshake +type ClientHi struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + UserAgent string `protobuf:"bytes,2,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` + Ver int32 `protobuf:"varint,3,opt,name=ver" json:"ver,omitempty"` + DeviceId string `protobuf:"bytes,4,opt,name=device_id,json=deviceId" json:"device_id,omitempty"` + Lang string `protobuf:"bytes,5,opt,name=lang" json:"lang,omitempty"` +} + +func (m *ClientHi) Reset() { *m = ClientHi{} } +func (m *ClientHi) String() string { return proto.CompactTextString(m) } +func (*ClientHi) ProtoMessage() {} +func (*ClientHi) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *ClientHi) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientHi) GetUserAgent() string { + if m != nil { + return m.UserAgent + } + return "" +} + +func (m *ClientHi) GetVer() int32 { + if m != nil { + return m.Ver + } + return 0 +} + +func (m *ClientHi) GetDeviceId() string { + if m != nil { + return m.DeviceId + } + return "" +} + +func (m *ClientHi) GetLang() string { + if m != nil { + return m.Lang + } + return "" +} + +// User creation message {acc} +type ClientAcc struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + // Types that are valid to be assigned to User: + // *ClientAcc_IsNew + // *ClientAcc_UserId + User isClientAcc_User `protobuf_oneof:"user"` + // The initial authentication scheme the account can use + Scheme string `protobuf:"bytes,4,opt,name=scheme" json:"scheme,omitempty"` + // Shared secret + Secret []byte `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"` + // Authenticate session with the newly created account + Login bool `protobuf:"varint,6,opt,name=login" json:"login,omitempty"` + // Indexable tags for user discovery + Tags []string `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"` + // User initialization data when creating a new user, otherwise ignored + Desc *SetDesc `protobuf:"bytes,8,opt,name=desc" json:"desc,omitempty"` +} + +func (m *ClientAcc) Reset() { *m = ClientAcc{} } +func (m *ClientAcc) String() string { return proto.CompactTextString(m) } +func (*ClientAcc) ProtoMessage() {} +func (*ClientAcc) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +type isClientAcc_User interface { + isClientAcc_User() +} + +type ClientAcc_IsNew struct { + IsNew bool `protobuf:"varint,2,opt,name=is_new,json=isNew,oneof"` +} +type ClientAcc_UserId struct { + UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,oneof"` +} + +func (*ClientAcc_IsNew) isClientAcc_User() {} +func (*ClientAcc_UserId) isClientAcc_User() {} + +func (m *ClientAcc) GetUser() isClientAcc_User { + if m != nil { + return m.User + } + return nil +} + +func (m *ClientAcc) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientAcc) GetIsNew() bool { + if x, ok := m.GetUser().(*ClientAcc_IsNew); ok { + return x.IsNew + } + return false +} + +func (m *ClientAcc) GetUserId() string { + if x, ok := m.GetUser().(*ClientAcc_UserId); ok { + return x.UserId + } + return "" +} + +func (m *ClientAcc) GetScheme() string { + if m != nil { + return m.Scheme + } + return "" +} + +func (m *ClientAcc) GetSecret() []byte { + if m != nil { + return m.Secret + } + return nil +} + +func (m *ClientAcc) GetLogin() bool { + if m != nil { + return m.Login + } + return false +} + +func (m *ClientAcc) GetTags() []string { + if m != nil { + return m.Tags + } + return nil +} + +func (m *ClientAcc) GetDesc() *SetDesc { + if m != nil { + return m.Desc + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ClientAcc) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ClientAcc_OneofMarshaler, _ClientAcc_OneofUnmarshaler, _ClientAcc_OneofSizer, []interface{}{ + (*ClientAcc_IsNew)(nil), + (*ClientAcc_UserId)(nil), + } +} + +func _ClientAcc_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ClientAcc) + // user + switch x := m.User.(type) { + case *ClientAcc_IsNew: + t := uint64(0) + if x.IsNew { + t = 1 + } + b.EncodeVarint(2<<3 | proto.WireVarint) + b.EncodeVarint(t) + case *ClientAcc_UserId: + b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeStringBytes(x.UserId) + case nil: + default: + return fmt.Errorf("ClientAcc.User has unexpected type %T", x) + } + return nil +} + +func _ClientAcc_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ClientAcc) + switch tag { + case 2: // user.is_new + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.User = &ClientAcc_IsNew{x != 0} + return true, err + case 3: // user.user_id + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.User = &ClientAcc_UserId{x} + return true, err + default: + return false, nil + } +} + +func _ClientAcc_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ClientAcc) + // user + switch x := m.User.(type) { + case *ClientAcc_IsNew: + n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += 1 + case *ClientAcc_UserId: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.UserId))) + n += len(x.UserId) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Login {login} message +type ClientLogin struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + // Authentication scheme + Scheme string `protobuf:"bytes,2,opt,name=scheme" json:"scheme,omitempty"` + // Shared secret + Secret []byte `protobuf:"bytes,3,opt,name=secret,proto3" json:"secret,omitempty"` +} + +func (m *ClientLogin) Reset() { *m = ClientLogin{} } +func (m *ClientLogin) String() string { return proto.CompactTextString(m) } +func (*ClientLogin) ProtoMessage() {} +func (*ClientLogin) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *ClientLogin) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientLogin) GetScheme() string { + if m != nil { + return m.Scheme + } + return "" +} + +func (m *ClientLogin) GetSecret() []byte { + if m != nil { + return m.Secret + } + return nil +} + +// Subscription request {sub} message +type ClientSub struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + // mirrors {set} + SetQuery *SetQuery `protobuf:"bytes,3,opt,name=set_query,json=setQuery" json:"set_query,omitempty"` + // mirrors {get} + GetQuery *GetQuery `protobuf:"bytes,4,opt,name=get_query,json=getQuery" json:"get_query,omitempty"` +} + +func (m *ClientSub) Reset() { *m = ClientSub{} } +func (m *ClientSub) String() string { return proto.CompactTextString(m) } +func (*ClientSub) ProtoMessage() {} +func (*ClientSub) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *ClientSub) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientSub) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientSub) GetSetQuery() *SetQuery { + if m != nil { + return m.SetQuery + } + return nil +} + +func (m *ClientSub) GetGetQuery() *GetQuery { + if m != nil { + return m.GetQuery + } + return nil +} + +// Unsubscribe {leave} request message +type ClientLeave struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + Unsub bool `protobuf:"varint,3,opt,name=unsub" json:"unsub,omitempty"` +} + +func (m *ClientLeave) Reset() { *m = ClientLeave{} } +func (m *ClientLeave) String() string { return proto.CompactTextString(m) } +func (*ClientLeave) ProtoMessage() {} +func (*ClientLeave) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *ClientLeave) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientLeave) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientLeave) GetUnsub() bool { + if m != nil { + return m.Unsub + } + return false +} + +// ClientPub is client's request to publish data to topic subscribers {pub} +type ClientPub struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + NoEcho bool `protobuf:"varint,3,opt,name=no_echo,json=noEcho" json:"no_echo,omitempty"` + Head map[string]string `protobuf:"bytes,4,rep,name=head" json:"head,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Content []byte `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` +} + +func (m *ClientPub) Reset() { *m = ClientPub{} } +func (m *ClientPub) String() string { return proto.CompactTextString(m) } +func (*ClientPub) ProtoMessage() {} +func (*ClientPub) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *ClientPub) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientPub) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientPub) GetNoEcho() bool { + if m != nil { + return m.NoEcho + } + return false +} + +func (m *ClientPub) GetHead() map[string]string { + if m != nil { + return m.Head + } + return nil +} + +func (m *ClientPub) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +// Query topic state {get} +type ClientGet struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + Query *GetQuery `protobuf:"bytes,3,opt,name=query" json:"query,omitempty"` +} + +func (m *ClientGet) Reset() { *m = ClientGet{} } +func (m *ClientGet) String() string { return proto.CompactTextString(m) } +func (*ClientGet) ProtoMessage() {} +func (*ClientGet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *ClientGet) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientGet) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientGet) GetQuery() *GetQuery { + if m != nil { + return m.Query + } + return nil +} + +// Update topic state {set} +type ClientSet struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + Query *SetQuery `protobuf:"bytes,3,opt,name=query" json:"query,omitempty"` +} + +func (m *ClientSet) Reset() { *m = ClientSet{} } +func (m *ClientSet) String() string { return proto.CompactTextString(m) } +func (*ClientSet) ProtoMessage() {} +func (*ClientSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +func (m *ClientSet) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientSet) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientSet) GetQuery() *SetQuery { + if m != nil { + return m.Query + } + return nil +} + +// ClientDel delete messages or topic +type ClientDel struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + What ClientDel_What `protobuf:"varint,3,opt,name=what,enum=pbx.ClientDel_What" json:"what,omitempty"` + // Delete messages older than this seq ID (inclusive) + Before int32 `protobuf:"varint,4,opt,name=before" json:"before,omitempty"` + // List of Seq Ids to delete/mark as deleted + SeqList []int32 `protobuf:"varint,5,rep,packed,name=seq_list,json=seqList" json:"seq_list,omitempty"` + // User ID of the subscription to delete + UserId string `protobuf:"bytes,6,opt,name=user_id,json=userId" json:"user_id,omitempty"` + // Request to hard-delete messages for all users, if such option is available. + Hard bool `protobuf:"varint,7,opt,name=hard" json:"hard,omitempty"` +} + +func (m *ClientDel) Reset() { *m = ClientDel{} } +func (m *ClientDel) String() string { return proto.CompactTextString(m) } +func (*ClientDel) ProtoMessage() {} +func (*ClientDel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *ClientDel) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ClientDel) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientDel) GetWhat() ClientDel_What { + if m != nil { + return m.What + } + return ClientDel_MSG +} + +func (m *ClientDel) GetBefore() int32 { + if m != nil { + return m.Before + } + return 0 +} + +func (m *ClientDel) GetSeqList() []int32 { + if m != nil { + return m.SeqList + } + return nil +} + +func (m *ClientDel) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *ClientDel) GetHard() bool { + if m != nil { + return m.Hard + } + return false +} + +// ClientNote is a client-generated notification for topic subscribers +type ClientNote struct { + Topic string `protobuf:"bytes,1,opt,name=topic" json:"topic,omitempty"` + // what is being reported: "recv" - message received, "read" - message read, "kp" - typing notification + What InfoNote `protobuf:"varint,2,opt,name=what,enum=pbx.InfoNote" json:"what,omitempty"` + // Server-issued message ID being reported + SeqId int32 `protobuf:"varint,3,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` +} + +func (m *ClientNote) Reset() { *m = ClientNote{} } +func (m *ClientNote) String() string { return proto.CompactTextString(m) } +func (*ClientNote) ProtoMessage() {} +func (*ClientNote) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + +func (m *ClientNote) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ClientNote) GetWhat() InfoNote { + if m != nil { + return m.What + } + return InfoNote_READ +} + +func (m *ClientNote) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +type ClientMsg struct { + // Types that are valid to be assigned to Message: + // *ClientMsg_Hi + // *ClientMsg_Acc + // *ClientMsg_Login + // *ClientMsg_Sub + // *ClientMsg_Leave + // *ClientMsg_Pub + // *ClientMsg_Get + // *ClientMsg_Set + // *ClientMsg_Del + // *ClientMsg_Note + Message isClientMsg_Message `protobuf_oneof:"Message"` +} + +func (m *ClientMsg) Reset() { *m = ClientMsg{} } +func (m *ClientMsg) String() string { return proto.CompactTextString(m) } +func (*ClientMsg) ProtoMessage() {} +func (*ClientMsg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } + +type isClientMsg_Message interface { + isClientMsg_Message() +} + +type ClientMsg_Hi struct { + Hi *ClientHi `protobuf:"bytes,1,opt,name=hi,oneof"` +} +type ClientMsg_Acc struct { + Acc *ClientAcc `protobuf:"bytes,2,opt,name=acc,oneof"` +} +type ClientMsg_Login struct { + Login *ClientLogin `protobuf:"bytes,3,opt,name=login,oneof"` +} +type ClientMsg_Sub struct { + Sub *ClientSub `protobuf:"bytes,4,opt,name=sub,oneof"` +} +type ClientMsg_Leave struct { + Leave *ClientLeave `protobuf:"bytes,5,opt,name=leave,oneof"` +} +type ClientMsg_Pub struct { + Pub *ClientPub `protobuf:"bytes,6,opt,name=pub,oneof"` +} +type ClientMsg_Get struct { + Get *ClientGet `protobuf:"bytes,7,opt,name=get,oneof"` +} +type ClientMsg_Set struct { + Set *ClientSet `protobuf:"bytes,8,opt,name=set,oneof"` +} +type ClientMsg_Del struct { + Del *ClientDel `protobuf:"bytes,9,opt,name=del,oneof"` +} +type ClientMsg_Note struct { + Note *ClientNote `protobuf:"bytes,10,opt,name=note,oneof"` +} + +func (*ClientMsg_Hi) isClientMsg_Message() {} +func (*ClientMsg_Acc) isClientMsg_Message() {} +func (*ClientMsg_Login) isClientMsg_Message() {} +func (*ClientMsg_Sub) isClientMsg_Message() {} +func (*ClientMsg_Leave) isClientMsg_Message() {} +func (*ClientMsg_Pub) isClientMsg_Message() {} +func (*ClientMsg_Get) isClientMsg_Message() {} +func (*ClientMsg_Set) isClientMsg_Message() {} +func (*ClientMsg_Del) isClientMsg_Message() {} +func (*ClientMsg_Note) isClientMsg_Message() {} + +func (m *ClientMsg) GetMessage() isClientMsg_Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *ClientMsg) GetHi() *ClientHi { + if x, ok := m.GetMessage().(*ClientMsg_Hi); ok { + return x.Hi + } + return nil +} + +func (m *ClientMsg) GetAcc() *ClientAcc { + if x, ok := m.GetMessage().(*ClientMsg_Acc); ok { + return x.Acc + } + return nil +} + +func (m *ClientMsg) GetLogin() *ClientLogin { + if x, ok := m.GetMessage().(*ClientMsg_Login); ok { + return x.Login + } + return nil +} + +func (m *ClientMsg) GetSub() *ClientSub { + if x, ok := m.GetMessage().(*ClientMsg_Sub); ok { + return x.Sub + } + return nil +} + +func (m *ClientMsg) GetLeave() *ClientLeave { + if x, ok := m.GetMessage().(*ClientMsg_Leave); ok { + return x.Leave + } + return nil +} + +func (m *ClientMsg) GetPub() *ClientPub { + if x, ok := m.GetMessage().(*ClientMsg_Pub); ok { + return x.Pub + } + return nil +} + +func (m *ClientMsg) GetGet() *ClientGet { + if x, ok := m.GetMessage().(*ClientMsg_Get); ok { + return x.Get + } + return nil +} + +func (m *ClientMsg) GetSet() *ClientSet { + if x, ok := m.GetMessage().(*ClientMsg_Set); ok { + return x.Set + } + return nil +} + +func (m *ClientMsg) GetDel() *ClientDel { + if x, ok := m.GetMessage().(*ClientMsg_Del); ok { + return x.Del + } + return nil +} + +func (m *ClientMsg) GetNote() *ClientNote { + if x, ok := m.GetMessage().(*ClientMsg_Note); ok { + return x.Note + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ClientMsg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ClientMsg_OneofMarshaler, _ClientMsg_OneofUnmarshaler, _ClientMsg_OneofSizer, []interface{}{ + (*ClientMsg_Hi)(nil), + (*ClientMsg_Acc)(nil), + (*ClientMsg_Login)(nil), + (*ClientMsg_Sub)(nil), + (*ClientMsg_Leave)(nil), + (*ClientMsg_Pub)(nil), + (*ClientMsg_Get)(nil), + (*ClientMsg_Set)(nil), + (*ClientMsg_Del)(nil), + (*ClientMsg_Note)(nil), + } +} + +func _ClientMsg_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ClientMsg) + // Message + switch x := m.Message.(type) { + case *ClientMsg_Hi: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Hi); err != nil { + return err + } + case *ClientMsg_Acc: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Acc); err != nil { + return err + } + case *ClientMsg_Login: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Login); err != nil { + return err + } + case *ClientMsg_Sub: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Sub); err != nil { + return err + } + case *ClientMsg_Leave: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Leave); err != nil { + return err + } + case *ClientMsg_Pub: + b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Pub); err != nil { + return err + } + case *ClientMsg_Get: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Get); err != nil { + return err + } + case *ClientMsg_Set: + b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Set); err != nil { + return err + } + case *ClientMsg_Del: + b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Del); err != nil { + return err + } + case *ClientMsg_Note: + b.EncodeVarint(10<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Note); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ClientMsg.Message has unexpected type %T", x) + } + return nil +} + +func _ClientMsg_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ClientMsg) + switch tag { + case 1: // Message.hi + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientHi) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Hi{msg} + return true, err + case 2: // Message.acc + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientAcc) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Acc{msg} + return true, err + case 3: // Message.login + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientLogin) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Login{msg} + return true, err + case 4: // Message.sub + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientSub) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Sub{msg} + return true, err + case 5: // Message.leave + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientLeave) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Leave{msg} + return true, err + case 6: // Message.pub + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientPub) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Pub{msg} + return true, err + case 7: // Message.get + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientGet) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Get{msg} + return true, err + case 8: // Message.set + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientSet) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Set{msg} + return true, err + case 9: // Message.del + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientDel) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Del{msg} + return true, err + case 10: // Message.note + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ClientNote) + err := b.DecodeMessage(msg) + m.Message = &ClientMsg_Note{msg} + return true, err + default: + return false, nil + } +} + +func _ClientMsg_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ClientMsg) + // Message + switch x := m.Message.(type) { + case *ClientMsg_Hi: + s := proto.Size(x.Hi) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Acc: + s := proto.Size(x.Acc) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Login: + s := proto.Size(x.Login) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Sub: + s := proto.Size(x.Sub) + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Leave: + s := proto.Size(x.Leave) + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Pub: + s := proto.Size(x.Pub) + n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Get: + s := proto.Size(x.Get) + n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Set: + s := proto.Size(x.Set) + n += proto.SizeVarint(8<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Del: + s := proto.Size(x.Del) + n += proto.SizeVarint(9<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ClientMsg_Note: + s := proto.Size(x.Note) + n += proto.SizeVarint(10<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Topic description, S2C in Meta message +type TopicDesc struct { + CreatedAt int64 `protobuf:"varint,1,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,2,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"` + Defacs *DefaultAcsMode `protobuf:"bytes,4,opt,name=defacs" json:"defacs,omitempty"` + Acs *AccessMode `protobuf:"bytes,5,opt,name=acs" json:"acs,omitempty"` + SeqId int32 `protobuf:"varint,6,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` + ReadId int32 `protobuf:"varint,7,opt,name=read_id,json=readId" json:"read_id,omitempty"` + RecvId int32 `protobuf:"varint,8,opt,name=recv_id,json=recvId" json:"recv_id,omitempty"` + ClearId int32 `protobuf:"varint,9,opt,name=clear_id,json=clearId" json:"clear_id,omitempty"` + Public []byte `protobuf:"bytes,10,opt,name=public,proto3" json:"public,omitempty"` + Private []byte `protobuf:"bytes,11,opt,name=private,proto3" json:"private,omitempty"` +} + +func (m *TopicDesc) Reset() { *m = TopicDesc{} } +func (m *TopicDesc) String() string { return proto.CompactTextString(m) } +func (*TopicDesc) ProtoMessage() {} +func (*TopicDesc) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } + +func (m *TopicDesc) GetCreatedAt() int64 { + if m != nil { + return m.CreatedAt + } + return 0 +} + +func (m *TopicDesc) GetUpdatedAt() int64 { + if m != nil { + return m.UpdatedAt + } + return 0 +} + +func (m *TopicDesc) GetDefacs() *DefaultAcsMode { + if m != nil { + return m.Defacs + } + return nil +} + +func (m *TopicDesc) GetAcs() *AccessMode { + if m != nil { + return m.Acs + } + return nil +} + +func (m *TopicDesc) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +func (m *TopicDesc) GetReadId() int32 { + if m != nil { + return m.ReadId + } + return 0 +} + +func (m *TopicDesc) GetRecvId() int32 { + if m != nil { + return m.RecvId + } + return 0 +} + +func (m *TopicDesc) GetClearId() int32 { + if m != nil { + return m.ClearId + } + return 0 +} + +func (m *TopicDesc) GetPublic() []byte { + if m != nil { + return m.Public + } + return nil +} + +func (m *TopicDesc) GetPrivate() []byte { + if m != nil { + return m.Private + } + return nil +} + +// MsgTopicSub: topic subscription details, sent in Meta message +type TopicSub struct { + UpdatedAt int64 `protobuf:"varint,1,opt,name=updated_at,json=updatedAt" json:"updated_at,omitempty"` + DeletedAt int64 `protobuf:"varint,2,opt,name=deleted_at,json=deletedAt" json:"deleted_at,omitempty"` + Online bool `protobuf:"varint,3,opt,name=online" json:"online,omitempty"` + Acs *AccessMode `protobuf:"bytes,4,opt,name=acs" json:"acs,omitempty"` + ReadId int32 `protobuf:"varint,5,opt,name=read_id,json=readId" json:"read_id,omitempty"` + RecvId int32 `protobuf:"varint,6,opt,name=recv_id,json=recvId" json:"recv_id,omitempty"` + Public []byte `protobuf:"bytes,7,opt,name=public,proto3" json:"public,omitempty"` + Private []byte `protobuf:"bytes,8,opt,name=private,proto3" json:"private,omitempty"` + // Uid of the subscribed user + UserId string `protobuf:"bytes,9,opt,name=user_id,json=userId" json:"user_id,omitempty"` + // Topic name of this subscription + Topic string `protobuf:"bytes,10,opt,name=topic" json:"topic,omitempty"` + // ID of the last {data} message in a topic + SeqId int32 `protobuf:"varint,11,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` + // Messages are deleted up to this ID + ClearId int32 `protobuf:"varint,12,opt,name=clear_id,json=clearId" json:"clear_id,omitempty"` + // Other user's last online timestamp & user agent + LastSeenTime int64 `protobuf:"varint,13,opt,name=last_seen_time,json=lastSeenTime" json:"last_seen_time,omitempty"` + LastSeenUserAgent string `protobuf:"bytes,14,opt,name=last_seen_user_agent,json=lastSeenUserAgent" json:"last_seen_user_agent,omitempty"` +} + +func (m *TopicSub) Reset() { *m = TopicSub{} } +func (m *TopicSub) String() string { return proto.CompactTextString(m) } +func (*TopicSub) ProtoMessage() {} +func (*TopicSub) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } + +func (m *TopicSub) GetUpdatedAt() int64 { + if m != nil { + return m.UpdatedAt + } + return 0 +} + +func (m *TopicSub) GetDeletedAt() int64 { + if m != nil { + return m.DeletedAt + } + return 0 +} + +func (m *TopicSub) GetOnline() bool { + if m != nil { + return m.Online + } + return false +} + +func (m *TopicSub) GetAcs() *AccessMode { + if m != nil { + return m.Acs + } + return nil +} + +func (m *TopicSub) GetReadId() int32 { + if m != nil { + return m.ReadId + } + return 0 +} + +func (m *TopicSub) GetRecvId() int32 { + if m != nil { + return m.RecvId + } + return 0 +} + +func (m *TopicSub) GetPublic() []byte { + if m != nil { + return m.Public + } + return nil +} + +func (m *TopicSub) GetPrivate() []byte { + if m != nil { + return m.Private + } + return nil +} + +func (m *TopicSub) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *TopicSub) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *TopicSub) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +func (m *TopicSub) GetClearId() int32 { + if m != nil { + return m.ClearId + } + return 0 +} + +func (m *TopicSub) GetLastSeenTime() int64 { + if m != nil { + return m.LastSeenTime + } + return 0 +} + +func (m *TopicSub) GetLastSeenUserAgent() string { + if m != nil { + return m.LastSeenUserAgent + } + return "" +} + +// {ctrl} message +type ServerCtrl struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Code int32 `protobuf:"varint,2,opt,name=code" json:"code,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text" json:"text,omitempty"` + Params map[string][]byte `protobuf:"bytes,4,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *ServerCtrl) Reset() { *m = ServerCtrl{} } +func (m *ServerCtrl) String() string { return proto.CompactTextString(m) } +func (*ServerCtrl) ProtoMessage() {} +func (*ServerCtrl) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } + +func (m *ServerCtrl) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ServerCtrl) GetCode() int32 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *ServerCtrl) GetText() string { + if m != nil { + return m.Text + } + return "" +} + +func (m *ServerCtrl) GetParams() map[string][]byte { + if m != nil { + return m.Params + } + return nil +} + +// {data} message +type ServerData struct { + Topic string `protobuf:"bytes,1,opt,name=topic" json:"topic,omitempty"` + // ID of the user who originated the message as {pub}, could be empty if sent by the system + FromUserId string `protobuf:"bytes,2,opt,name=from_user_id,json=fromUserId" json:"from_user_id,omitempty"` + // Timestamp when the message was deleted or 0. Milliseconds since the epoch 01/01/1970 + DeletedAt int64 `protobuf:"varint,3,opt,name=deleted_at,json=deletedAt" json:"deleted_at,omitempty"` + SeqId int32 `protobuf:"varint,4,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` + Head map[string]string `protobuf:"bytes,5,rep,name=head" json:"head,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Content []byte `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` +} + +func (m *ServerData) Reset() { *m = ServerData{} } +func (m *ServerData) String() string { return proto.CompactTextString(m) } +func (*ServerData) ProtoMessage() {} +func (*ServerData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } + +func (m *ServerData) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ServerData) GetFromUserId() string { + if m != nil { + return m.FromUserId + } + return "" +} + +func (m *ServerData) GetDeletedAt() int64 { + if m != nil { + return m.DeletedAt + } + return 0 +} + +func (m *ServerData) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +func (m *ServerData) GetHead() map[string]string { + if m != nil { + return m.Head + } + return nil +} + +func (m *ServerData) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +// {pres} message +type ServerPres struct { + Topic string `protobuf:"bytes,1,opt,name=topic" json:"topic,omitempty"` + Src string `protobuf:"bytes,2,opt,name=src" json:"src,omitempty"` + What ServerPres_What `protobuf:"varint,3,opt,name=what,enum=pbx.ServerPres_What" json:"what,omitempty"` + UserAgent string `protobuf:"bytes,4,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` + SeqId int32 `protobuf:"varint,5,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` + SeqList []int32 `protobuf:"varint,6,rep,packed,name=seq_list,json=seqList" json:"seq_list,omitempty"` + TargetUserId string `protobuf:"bytes,7,opt,name=target_user_id,json=targetUserId" json:"target_user_id,omitempty"` + ActorUserId string `protobuf:"bytes,8,opt,name=actor_user_id,json=actorUserId" json:"actor_user_id,omitempty"` + Acs *AccessMode `protobuf:"bytes,9,opt,name=acs" json:"acs,omitempty"` +} + +func (m *ServerPres) Reset() { *m = ServerPres{} } +func (m *ServerPres) String() string { return proto.CompactTextString(m) } +func (*ServerPres) ProtoMessage() {} +func (*ServerPres) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } + +func (m *ServerPres) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ServerPres) GetSrc() string { + if m != nil { + return m.Src + } + return "" +} + +func (m *ServerPres) GetWhat() ServerPres_What { + if m != nil { + return m.What + } + return ServerPres_ON +} + +func (m *ServerPres) GetUserAgent() string { + if m != nil { + return m.UserAgent + } + return "" +} + +func (m *ServerPres) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +func (m *ServerPres) GetSeqList() []int32 { + if m != nil { + return m.SeqList + } + return nil +} + +func (m *ServerPres) GetTargetUserId() string { + if m != nil { + return m.TargetUserId + } + return "" +} + +func (m *ServerPres) GetActorUserId() string { + if m != nil { + return m.ActorUserId + } + return "" +} + +func (m *ServerPres) GetAcs() *AccessMode { + if m != nil { + return m.Acs + } + return nil +} + +// {meta} message +type ServerMeta struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + Desc *TopicDesc `protobuf:"bytes,3,opt,name=desc" json:"desc,omitempty"` + Sub []*TopicSub `protobuf:"bytes,4,rep,name=sub" json:"sub,omitempty"` +} + +func (m *ServerMeta) Reset() { *m = ServerMeta{} } +func (m *ServerMeta) String() string { return proto.CompactTextString(m) } +func (*ServerMeta) ProtoMessage() {} +func (*ServerMeta) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } + +func (m *ServerMeta) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ServerMeta) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ServerMeta) GetDesc() *TopicDesc { + if m != nil { + return m.Desc + } + return nil +} + +func (m *ServerMeta) GetSub() []*TopicSub { + if m != nil { + return m.Sub + } + return nil +} + +// {info} message: server-side copy of ClientNote with From added +type ServerInfo struct { + Topic string `protobuf:"bytes,1,opt,name=topic" json:"topic,omitempty"` + FromUserId string `protobuf:"bytes,2,opt,name=from_user_id,json=fromUserId" json:"from_user_id,omitempty"` + What InfoNote `protobuf:"varint,3,opt,name=what,enum=pbx.InfoNote" json:"what,omitempty"` + SeqId int32 `protobuf:"varint,4,opt,name=seq_id,json=seqId" json:"seq_id,omitempty"` +} + +func (m *ServerInfo) Reset() { *m = ServerInfo{} } +func (m *ServerInfo) String() string { return proto.CompactTextString(m) } +func (*ServerInfo) ProtoMessage() {} +func (*ServerInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } + +func (m *ServerInfo) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *ServerInfo) GetFromUserId() string { + if m != nil { + return m.FromUserId + } + return "" +} + +func (m *ServerInfo) GetWhat() InfoNote { + if m != nil { + return m.What + } + return InfoNote_READ +} + +func (m *ServerInfo) GetSeqId() int32 { + if m != nil { + return m.SeqId + } + return 0 +} + +// Cumulative message +type ServerMsg struct { + // Types that are valid to be assigned to Message: + // *ServerMsg_Ctrl + // *ServerMsg_Data + // *ServerMsg_Pres + // *ServerMsg_Meta + // *ServerMsg_Info + Message isServerMsg_Message `protobuf_oneof:"Message"` +} + +func (m *ServerMsg) Reset() { *m = ServerMsg{} } +func (m *ServerMsg) String() string { return proto.CompactTextString(m) } +func (*ServerMsg) ProtoMessage() {} +func (*ServerMsg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } + +type isServerMsg_Message interface { + isServerMsg_Message() +} + +type ServerMsg_Ctrl struct { + Ctrl *ServerCtrl `protobuf:"bytes,1,opt,name=ctrl,oneof"` +} +type ServerMsg_Data struct { + Data *ServerData `protobuf:"bytes,2,opt,name=data,oneof"` +} +type ServerMsg_Pres struct { + Pres *ServerPres `protobuf:"bytes,3,opt,name=pres,oneof"` +} +type ServerMsg_Meta struct { + Meta *ServerMeta `protobuf:"bytes,4,opt,name=meta,oneof"` +} +type ServerMsg_Info struct { + Info *ServerInfo `protobuf:"bytes,5,opt,name=info,oneof"` +} + +func (*ServerMsg_Ctrl) isServerMsg_Message() {} +func (*ServerMsg_Data) isServerMsg_Message() {} +func (*ServerMsg_Pres) isServerMsg_Message() {} +func (*ServerMsg_Meta) isServerMsg_Message() {} +func (*ServerMsg_Info) isServerMsg_Message() {} + +func (m *ServerMsg) GetMessage() isServerMsg_Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *ServerMsg) GetCtrl() *ServerCtrl { + if x, ok := m.GetMessage().(*ServerMsg_Ctrl); ok { + return x.Ctrl + } + return nil +} + +func (m *ServerMsg) GetData() *ServerData { + if x, ok := m.GetMessage().(*ServerMsg_Data); ok { + return x.Data + } + return nil +} + +func (m *ServerMsg) GetPres() *ServerPres { + if x, ok := m.GetMessage().(*ServerMsg_Pres); ok { + return x.Pres + } + return nil +} + +func (m *ServerMsg) GetMeta() *ServerMeta { + if x, ok := m.GetMessage().(*ServerMsg_Meta); ok { + return x.Meta + } + return nil +} + +func (m *ServerMsg) GetInfo() *ServerInfo { + if x, ok := m.GetMessage().(*ServerMsg_Info); ok { + return x.Info + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ServerMsg) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ServerMsg_OneofMarshaler, _ServerMsg_OneofUnmarshaler, _ServerMsg_OneofSizer, []interface{}{ + (*ServerMsg_Ctrl)(nil), + (*ServerMsg_Data)(nil), + (*ServerMsg_Pres)(nil), + (*ServerMsg_Meta)(nil), + (*ServerMsg_Info)(nil), + } +} + +func _ServerMsg_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ServerMsg) + // Message + switch x := m.Message.(type) { + case *ServerMsg_Ctrl: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Ctrl); err != nil { + return err + } + case *ServerMsg_Data: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Data); err != nil { + return err + } + case *ServerMsg_Pres: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Pres); err != nil { + return err + } + case *ServerMsg_Meta: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Meta); err != nil { + return err + } + case *ServerMsg_Info: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Info); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("ServerMsg.Message has unexpected type %T", x) + } + return nil +} + +func _ServerMsg_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ServerMsg) + switch tag { + case 1: // Message.ctrl + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerCtrl) + err := b.DecodeMessage(msg) + m.Message = &ServerMsg_Ctrl{msg} + return true, err + case 2: // Message.data + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerData) + err := b.DecodeMessage(msg) + m.Message = &ServerMsg_Data{msg} + return true, err + case 3: // Message.pres + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerPres) + err := b.DecodeMessage(msg) + m.Message = &ServerMsg_Pres{msg} + return true, err + case 4: // Message.meta + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerMeta) + err := b.DecodeMessage(msg) + m.Message = &ServerMsg_Meta{msg} + return true, err + case 5: // Message.info + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ServerInfo) + err := b.DecodeMessage(msg) + m.Message = &ServerMsg_Info{msg} + return true, err + default: + return false, nil + } +} + +func _ServerMsg_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ServerMsg) + // Message + switch x := m.Message.(type) { + case *ServerMsg_Ctrl: + s := proto.Size(x.Ctrl) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerMsg_Data: + s := proto.Size(x.Data) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerMsg_Pres: + s := proto.Size(x.Pres) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerMsg_Meta: + s := proto.Size(x.Meta) + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ServerMsg_Info: + s := proto.Size(x.Info) + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Session struct { + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId" json:"session_id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId" json:"user_id,omitempty"` + AuthLevel Session_AuthLevel `protobuf:"varint,3,opt,name=auth_level,json=authLevel,enum=pbx.Session_AuthLevel" json:"auth_level,omitempty"` + RemoteAddr string `protobuf:"bytes,4,opt,name=remote_addr,json=remoteAddr" json:"remote_addr,omitempty"` + UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` + DeviceId string `protobuf:"bytes,6,opt,name=device_id,json=deviceId" json:"device_id,omitempty"` + Language string `protobuf:"bytes,7,opt,name=language" json:"language,omitempty"` +} + +func (m *Session) Reset() { *m = Session{} } +func (m *Session) String() string { return proto.CompactTextString(m) } +func (*Session) ProtoMessage() {} +func (*Session) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } + +func (m *Session) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +func (m *Session) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *Session) GetAuthLevel() Session_AuthLevel { + if m != nil { + return m.AuthLevel + } + return Session_NONE +} + +func (m *Session) GetRemoteAddr() string { + if m != nil { + return m.RemoteAddr + } + return "" +} + +func (m *Session) GetUserAgent() string { + if m != nil { + return m.UserAgent + } + return "" +} + +func (m *Session) GetDeviceId() string { + if m != nil { + return m.DeviceId + } + return "" +} + +func (m *Session) GetLanguage() string { + if m != nil { + return m.Language + } + return "" +} + +type Topic struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + AccessAuth string `protobuf:"bytes,2,opt,name=access_auth,json=accessAuth" json:"access_auth,omitempty"` + AccessAnon string `protobuf:"bytes,3,opt,name=access_anon,json=accessAnon" json:"access_anon,omitempty"` + Public []byte `protobuf:"bytes,4,opt,name=public,proto3" json:"public,omitempty"` + Private []byte `protobuf:"bytes,5,opt,name=private,proto3" json:"private,omitempty"` +} + +func (m *Topic) Reset() { *m = Topic{} } +func (m *Topic) String() string { return proto.CompactTextString(m) } +func (*Topic) ProtoMessage() {} +func (*Topic) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } + +func (m *Topic) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Topic) GetAccessAuth() string { + if m != nil { + return m.AccessAuth + } + return "" +} + +func (m *Topic) GetAccessAnon() string { + if m != nil { + return m.AccessAnon + } + return "" +} + +func (m *Topic) GetPublic() []byte { + if m != nil { + return m.Public + } + return nil +} + +func (m *Topic) GetPrivate() []byte { + if m != nil { + return m.Private + } + return nil +} + +type User struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + ModeWant string `protobuf:"bytes,2,opt,name=mode_want,json=modeWant" json:"mode_want,omitempty"` + ModeGiven string `protobuf:"bytes,3,opt,name=mode_given,json=modeGiven" json:"mode_given,omitempty"` + Public []byte `protobuf:"bytes,4,opt,name=public,proto3" json:"public,omitempty"` +} + +func (m *User) Reset() { *m = User{} } +func (m *User) String() string { return proto.CompactTextString(m) } +func (*User) ProtoMessage() {} +func (*User) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } + +func (m *User) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *User) GetModeWant() string { + if m != nil { + return m.ModeWant + } + return "" +} + +func (m *User) GetModeGiven() string { + if m != nil { + return m.ModeGiven + } + return "" +} + +func (m *User) GetPublic() []byte { + if m != nil { + return m.Public + } + return nil +} + +type ClientReq struct { + Msg *ClientMsg `protobuf:"bytes,1,opt,name=msg" json:"msg,omitempty"` + Sess *Session `protobuf:"bytes,2,opt,name=sess" json:"sess,omitempty"` +} + +func (m *ClientReq) Reset() { *m = ClientReq{} } +func (m *ClientReq) String() string { return proto.CompactTextString(m) } +func (*ClientReq) ProtoMessage() {} +func (*ClientReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } + +func (m *ClientReq) GetMsg() *ClientMsg { + if m != nil { + return m.Msg + } + return nil +} + +func (m *ClientReq) GetSess() *Session { + if m != nil { + return m.Sess + } + return nil +} + +func init() { + proto.RegisterType((*DefaultAcsMode)(nil), "pbx.DefaultAcsMode") + proto.RegisterType((*AccessMode)(nil), "pbx.AccessMode") + proto.RegisterType((*SetSub)(nil), "pbx.SetSub") + proto.RegisterType((*SetDesc)(nil), "pbx.SetDesc") + proto.RegisterType((*GetOpts)(nil), "pbx.GetOpts") + proto.RegisterType((*BrowseOpts)(nil), "pbx.BrowseOpts") + proto.RegisterType((*GetQuery)(nil), "pbx.GetQuery") + proto.RegisterType((*SetQuery)(nil), "pbx.SetQuery") + proto.RegisterType((*ClientHi)(nil), "pbx.ClientHi") + proto.RegisterType((*ClientAcc)(nil), "pbx.ClientAcc") + proto.RegisterType((*ClientLogin)(nil), "pbx.ClientLogin") + proto.RegisterType((*ClientSub)(nil), "pbx.ClientSub") + proto.RegisterType((*ClientLeave)(nil), "pbx.ClientLeave") + proto.RegisterType((*ClientPub)(nil), "pbx.ClientPub") + proto.RegisterType((*ClientGet)(nil), "pbx.ClientGet") + proto.RegisterType((*ClientSet)(nil), "pbx.ClientSet") + proto.RegisterType((*ClientDel)(nil), "pbx.ClientDel") + proto.RegisterType((*ClientNote)(nil), "pbx.ClientNote") + proto.RegisterType((*ClientMsg)(nil), "pbx.ClientMsg") + proto.RegisterType((*TopicDesc)(nil), "pbx.TopicDesc") + proto.RegisterType((*TopicSub)(nil), "pbx.TopicSub") + proto.RegisterType((*ServerCtrl)(nil), "pbx.ServerCtrl") + proto.RegisterType((*ServerData)(nil), "pbx.ServerData") + proto.RegisterType((*ServerPres)(nil), "pbx.ServerPres") + proto.RegisterType((*ServerMeta)(nil), "pbx.ServerMeta") + proto.RegisterType((*ServerInfo)(nil), "pbx.ServerInfo") + proto.RegisterType((*ServerMsg)(nil), "pbx.ServerMsg") + proto.RegisterType((*Session)(nil), "pbx.Session") + proto.RegisterType((*Topic)(nil), "pbx.Topic") + proto.RegisterType((*User)(nil), "pbx.User") + proto.RegisterType((*ClientReq)(nil), "pbx.ClientReq") + proto.RegisterEnum("pbx.InfoNote", InfoNote_name, InfoNote_value) + proto.RegisterEnum("pbx.ClientDel_What", ClientDel_What_name, ClientDel_What_value) + proto.RegisterEnum("pbx.ServerPres_What", ServerPres_What_name, ServerPres_What_value) + proto.RegisterEnum("pbx.Session_AuthLevel", Session_AuthLevel_name, Session_AuthLevel_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Node service + +type NodeClient interface { + // Client sends a stream of ClientMsg, server responds with a stream of ServerMsg + MessageLoop(ctx context.Context, opts ...grpc.CallOption) (Node_MessageLoopClient, error) +} + +type nodeClient struct { + cc *grpc.ClientConn +} + +func NewNodeClient(cc *grpc.ClientConn) NodeClient { + return &nodeClient{cc} +} + +func (c *nodeClient) MessageLoop(ctx context.Context, opts ...grpc.CallOption) (Node_MessageLoopClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Node_serviceDesc.Streams[0], c.cc, "/pbx.Node/MessageLoop", opts...) + if err != nil { + return nil, err + } + x := &nodeMessageLoopClient{stream} + return x, nil +} + +type Node_MessageLoopClient interface { + Send(*ClientMsg) error + Recv() (*ServerMsg, error) + grpc.ClientStream +} + +type nodeMessageLoopClient struct { + grpc.ClientStream +} + +func (x *nodeMessageLoopClient) Send(m *ClientMsg) error { + return x.ClientStream.SendMsg(m) +} + +func (x *nodeMessageLoopClient) Recv() (*ServerMsg, error) { + m := new(ServerMsg) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Node service + +type NodeServer interface { + // Client sends a stream of ClientMsg, server responds with a stream of ServerMsg + MessageLoop(Node_MessageLoopServer) error +} + +func RegisterNodeServer(s *grpc.Server, srv NodeServer) { + s.RegisterService(&_Node_serviceDesc, srv) +} + +func _Node_MessageLoop_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(NodeServer).MessageLoop(&nodeMessageLoopServer{stream}) +} + +type Node_MessageLoopServer interface { + Send(*ServerMsg) error + Recv() (*ClientMsg, error) + grpc.ServerStream +} + +type nodeMessageLoopServer struct { + grpc.ServerStream +} + +func (x *nodeMessageLoopServer) Send(m *ServerMsg) error { + return x.ServerStream.SendMsg(m) +} + +func (x *nodeMessageLoopServer) Recv() (*ClientMsg, error) { + m := new(ClientMsg) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Node_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pbx.Node", + HandlerType: (*NodeServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "MessageLoop", + Handler: _Node_MessageLoop_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "model.proto", +} + +// Client API for Plugin service + +type PluginClient interface { + // This plugin method is called for every message received from the client. The method returns + // a ServerCtrl message. ServerCtrl.code is not 0 indicates that no further processing is needed. Server + // will generate a {ctrl} message from ServerCtrl and forward it to the client session. + // If ServerCtrl.code is 0, the server should continue with default processing of the message. + ClientMessage(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*ServerCtrl, error) + // This method is called immmediately before a server message is broadcasted to topic subscribers. + // The filter may alter the server message or may request to drop it. + ServerMessage(ctx context.Context, in *ServerMsg, opts ...grpc.CallOption) (*ServerMsg, error) +} + +type pluginClient struct { + cc *grpc.ClientConn +} + +func NewPluginClient(cc *grpc.ClientConn) PluginClient { + return &pluginClient{cc} +} + +func (c *pluginClient) ClientMessage(ctx context.Context, in *ClientReq, opts ...grpc.CallOption) (*ServerCtrl, error) { + out := new(ServerCtrl) + err := grpc.Invoke(ctx, "/pbx.Plugin/ClientMessage", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pluginClient) ServerMessage(ctx context.Context, in *ServerMsg, opts ...grpc.CallOption) (*ServerMsg, error) { + out := new(ServerMsg) + err := grpc.Invoke(ctx, "/pbx.Plugin/ServerMessage", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Plugin service + +type PluginServer interface { + // This plugin method is called for every message received from the client. The method returns + // a ServerCtrl message. ServerCtrl.code is not 0 indicates that no further processing is needed. Server + // will generate a {ctrl} message from ServerCtrl and forward it to the client session. + // If ServerCtrl.code is 0, the server should continue with default processing of the message. + ClientMessage(context.Context, *ClientReq) (*ServerCtrl, error) + // This method is called immmediately before a server message is broadcasted to topic subscribers. + // The filter may alter the server message or may request to drop it. + ServerMessage(context.Context, *ServerMsg) (*ServerMsg, error) +} + +func RegisterPluginServer(s *grpc.Server, srv PluginServer) { + s.RegisterService(&_Plugin_serviceDesc, srv) +} + +func _Plugin_ClientMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClientReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServer).ClientMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbx.Plugin/ClientMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServer).ClientMessage(ctx, req.(*ClientReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Plugin_ServerMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerMsg) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PluginServer).ServerMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pbx.Plugin/ServerMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PluginServer).ServerMessage(ctx, req.(*ServerMsg)) + } + return interceptor(ctx, in, info, handler) +} + +var _Plugin_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pbx.Plugin", + HandlerType: (*PluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ClientMessage", + Handler: _Plugin_ClientMessage_Handler, + }, + { + MethodName: "ServerMessage", + Handler: _Plugin_ServerMessage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "model.proto", +} + +func init() { proto.RegisterFile("model.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 2067 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x18, 0x4d, 0x73, 0xe3, 0x58, + 0xd1, 0xb6, 0x64, 0xd9, 0x6a, 0x27, 0x19, 0xad, 0x08, 0x33, 0x9e, 0x99, 0x9a, 0x9d, 0x8c, 0x66, + 0x81, 0xd4, 0x00, 0x01, 0x32, 0x2c, 0x2c, 0x70, 0xf2, 0x24, 0xd9, 0x24, 0x35, 0xf9, 0x42, 0x4e, + 0x76, 0x2f, 0x54, 0xb9, 0x64, 0xa9, 0x63, 0x8b, 0x95, 0x25, 0x47, 0xef, 0xd9, 0x99, 0xa9, 0xa2, + 0xb8, 0x71, 0x58, 0x2e, 0x54, 0xf1, 0x07, 0xb8, 0x71, 0xe5, 0xc2, 0xbf, 0xe0, 0xc8, 0x89, 0x13, + 0x7f, 0x84, 0x03, 0xd5, 0xef, 0x43, 0x96, 0x1c, 0xbc, 0x9b, 0x02, 0x6e, 0xef, 0x75, 0xf7, 0xeb, + 0xef, 0x2f, 0x09, 0x3a, 0x93, 0x2c, 0xc2, 0x64, 0x67, 0x9a, 0x67, 0x3c, 0x73, 0x8d, 0xe9, 0xf0, + 0x9d, 0xf7, 0x09, 0x6c, 0xec, 0xe3, 0x75, 0x30, 0x4b, 0x78, 0x2f, 0x64, 0xa7, 0x59, 0x84, 0xae, + 0x0b, 0x66, 0x30, 0xe3, 0xe3, 0x6e, 0x7d, 0xab, 0xbe, 0x6d, 0xfb, 0xe2, 0x2c, 0x60, 0x69, 0x96, + 0x76, 0x1b, 0x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71, 0xb4, 0x40, 0x71, 0x26, 0x58, 0x18, 0x0a, + 0x75, 0xc9, 0xdc, 0xa7, 0x60, 0x0f, 0xf1, 0x3a, 0xcb, 0xc5, 0x33, 0x43, 0x3c, 0x6b, 0x4b, 0xc0, + 0x71, 0x54, 0x42, 0x72, 0xd6, 0x35, 0xc5, 0x43, 0x85, 0xbc, 0x64, 0x0b, 0xa5, 0x9a, 0x65, 0xa5, + 0x7e, 0x57, 0x87, 0xf6, 0x21, 0xf2, 0x5f, 0xce, 0x30, 0x7f, 0x2f, 0x42, 0x38, 0x0e, 0x16, 0x21, + 0x1c, 0x07, 0xdc, 0xdd, 0x02, 0x33, 0x42, 0x26, 0x5d, 0xd6, 0xd9, 0x5d, 0x13, 0x3e, 0x56, 0x3e, + 0xf1, 0x05, 0xc6, 0xfd, 0x10, 0x0c, 0x36, 0x1b, 0x0a, 0x65, 0x96, 0x09, 0x08, 0xe1, 0xbe, 0x04, + 0x33, 0x0a, 0x78, 0x20, 0x14, 0xea, 0xec, 0x3e, 0x10, 0x04, 0x0b, 0x3f, 0xf8, 0x02, 0xe9, 0xbd, + 0x85, 0x76, 0x5f, 0xab, 0xa1, 0x45, 0xd6, 0x4b, 0x1c, 0x55, 0xe4, 0x95, 0xc8, 0x67, 0x52, 0xa4, + 0xd4, 0xa9, 0xa3, 0x09, 0xfa, 0xb3, 0xa1, 0x90, 0xe8, 0xfd, 0x06, 0xda, 0x7b, 0x49, 0x8c, 0x29, + 0x3f, 0x8a, 0xdd, 0x0d, 0x68, 0x14, 0xd9, 0xd5, 0x88, 0x23, 0xf7, 0x19, 0x80, 0x48, 0xb9, 0x60, + 0x84, 0x29, 0x57, 0xf9, 0x65, 0x13, 0xa4, 0x47, 0x00, 0xd7, 0x01, 0x63, 0x8e, 0xb9, 0xf2, 0x2c, + 0x1d, 0xc9, 0xa9, 0x11, 0xce, 0x63, 0x19, 0x28, 0x53, 0xd0, 0xb7, 0x25, 0x40, 0xe6, 0x69, 0x12, + 0xa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, 0xd4, 0x8b, 0xa2, 0x7c, 0xa9, + 0x36, 0x9b, 0xcb, 0xb5, 0x59, 0xf9, 0x3a, 0xb6, 0x96, 0xbe, 0x8e, 0x9f, 0x40, 0x9b, 0xbe, 0x88, + 0x67, 0xc1, 0x08, 0x55, 0x01, 0x16, 0x77, 0xef, 0x35, 0xd8, 0x85, 0x42, 0x94, 0xe8, 0x67, 0x54, + 0x18, 0x35, 0x3a, 0xf5, 0xce, 0xce, 0xcf, 0x1c, 0x10, 0xa7, 0xab, 0xcb, 0x23, 0x67, 0x53, 0x94, + 0xc1, 0xf9, 0xf9, 0xa5, 0xf3, 0xa1, 0xf7, 0x87, 0x3a, 0x34, 0x45, 0x5a, 0xd2, 0x58, 0x48, 0x83, + 0x09, 0xea, 0x5f, 0x15, 0x74, 0x26, 0x5b, 0x02, 0x51, 0x9b, 0x03, 0xf1, 0xfb, 0x4a, 0x65, 0x9f, + 0x04, 0x91, 0xac, 0x32, 0x41, 0x9a, 0xa5, 0x6a, 0xa4, 0x68, 0x82, 0x34, 0x4b, 0x4b, 0x93, 0xd8, + 0x5c, 0x35, 0x89, 0x9b, 0xd5, 0x9d, 0xe3, 0xd7, 0x60, 0x52, 0x6a, 0xdf, 0xa9, 0xc4, 0xa7, 0x60, + 0x4f, 0xb2, 0x08, 0x07, 0xe2, 0x97, 0x98, 0xd4, 0xa4, 0x4d, 0x80, 0xcf, 0x83, 0x54, 0xf4, 0x3b, + 0x81, 0x94, 0xff, 0xc6, 0xa4, 0x1a, 0x82, 0xfc, 0x90, 0x00, 0xab, 0xb4, 0xf0, 0xce, 0xf5, 0x76, + 0xee, 0xe3, 0x8d, 0xbb, 0x05, 0xc6, 0x84, 0x8d, 0x54, 0x01, 0x94, 0x97, 0xce, 0x53, 0x36, 0xf2, + 0x09, 0x45, 0xdf, 0xf6, 0x94, 0x37, 0x95, 0x3f, 0x37, 0x2a, 0x17, 0x7c, 0x81, 0x79, 0xf5, 0x6d, + 0x68, 0xeb, 0xe2, 0x2b, 0xba, 0x4e, 0xad, 0xe8, 0x3a, 0xa2, 0x81, 0xbd, 0xbd, 0x70, 0x1a, 0xbb, + 0xbf, 0x00, 0xf3, 0x8c, 0x66, 0xf1, 0x6b, 0xe8, 0xa8, 0x94, 0x3d, 0xc9, 0xb2, 0xa9, 0xbb, 0x24, + 0xf5, 0xc9, 0x46, 0xb9, 0x22, 0xd8, 0xc8, 0xab, 0x6d, 0xd7, 0x7f, 0x58, 0xdf, 0xcd, 0xc0, 0xba, + 0x48, 0x66, 0xb4, 0xe1, 0xef, 0xc2, 0xba, 0x22, 0x96, 0x4c, 0x2a, 0x0c, 0x7c, 0xbc, 0x79, 0xb2, + 0x5c, 0xc7, 0x5e, 0xcd, 0xfd, 0x11, 0xac, 0xeb, 0x12, 0x2b, 0xbf, 0x29, 0x84, 0xdc, 0x15, 0x3a, + 0xb4, 0xc4, 0xcf, 0xcd, 0xd7, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x60, 0xe9, 0xbb, 0xeb, + 0x14, 0x00, 0x00, +} diff --git a/pbx/model.proto b/pbx/model.proto new file mode 100644 index 000000000..77344256f --- /dev/null +++ b/pbx/model.proto @@ -0,0 +1,384 @@ +syntax = "proto3"; +package pbx; + +// This is the single method that needs to be implemented by a gRPC client. +service Node { + // Client sends a stream of ClientMsg, server responds with a stream of ServerMsg + rpc MessageLoop(stream ClientMsg) returns (stream ServerMsg) {} +} + +// Plugin interface. +service Plugin { + // This plugin method is called for every message received from the client. The method returns + // a ServerCtrl message. ServerCtrl.code is not 0 indicates that no further processing is needed. Server + // will generate a {ctrl} message from ServerCtrl and forward it to the client session. + // If ServerCtrl.code is 0, the server should continue with default processing of the message. + rpc ClientMessage(ClientReq) returns (ServerCtrl) {} + + // This method is called immmediately before a server message is broadcasted to topic subscribers. + // The filter may alter the server message or may request to drop it. + rpc ServerMessage(ServerMsg) returns (ServerMsg) {} +} + + +// Client messages + +// Topic default access mode +message DefaultAcsMode { + string auth = 1; + string anon = 2; +} + +// Actual access mode +message AccessMode { + // Access mode requested by the user + string want = 1; + // Access mode granted to the user by the admin + string given = 2; +} + +// SetSub: payload in set.sub request to update current subscription or invite another user, {sub.what} == "sub" +message SetSub { + // User affected by this request. Default (empty): current user + string user_id = 1; + + // Access mode change, either Given or Want depending on context + string mode = 2; +} + +// SetDesc: C2S in set.what == "desc" and sub.init message +message SetDesc { + DefaultAcsMode default_acs = 1; + bytes public = 2; + bytes private = 3; +} + +message GetOpts { + int64 if_modified_since = 1; // timestamp in milliseconds since epoch 01/01/1970 + int32 limit = 2; +} + +message BrowseOpts { + // Load messages with seq id equal or greater than this + int32 since_id = 1; + // Load messages with UpdatedAt equal or grater than this + int64 since_ts = 2; + // Load messages with seq id lower than this + int32 before_id = 3; + // Load messages with UpdatedAt lower than this + int64 before_ts = 4; + // Limit the number of messages loaded + int32 limit = 5; +} + +message GetQuery { + string what = 1; + + // Parameters of "desc" request + GetOpts desc = 2; + // Parameters of "sub" request + GetOpts sub = 3; + // Parameters of "data" request + BrowseOpts data = 4; +} + +message SetQuery { + // Topic metadata, new topic & new subscriptions only + SetDesc desc = 1; + // Subscription parameters + SetSub sub = 2; +} + +// Client handshake +message ClientHi { + string id = 1; + string user_agent = 2; + int32 ver = 3; + string device_id = 4; + string lang = 5; +} + +// User creation message {acc} +message ClientAcc { + string id = 1; + oneof user { + bool is_new = 2; + string user_id = 3; + } + // The initial authentication scheme the account can use + string scheme = 4; + // Shared secret + bytes secret = 5; + // Authenticate session with the newly created account + bool login = 6; + // Indexable tags for user discovery + repeated string tags = 7; + // User initialization data when creating a new user, otherwise ignored + SetDesc desc = 8; +} + +// Login {login} message +message ClientLogin { + string id = 1; + // Authentication scheme + string scheme = 2; + // Shared secret + bytes secret = 3; +} + +// Subscription request {sub} message +message ClientSub { + string id = 1; + string topic = 2; + + // mirrors {set} + SetQuery set_query = 3; + + // mirrors {get} + GetQuery get_query = 4; +} + +// Unsubscribe {leave} request message +message ClientLeave { + string id = 1; + string topic = 2; + bool unsub = 3; +} + +// ClientPub is client's request to publish data to topic subscribers {pub} +message ClientPub { + string id = 1; + string topic = 2; + bool no_echo = 3; + map head = 4; + bytes content = 5; +} + +// Query topic state {get} +message ClientGet { + string id = 1; + string topic = 2; + GetQuery query = 3; +} + +// Update topic state {set} +message ClientSet { + string id = 1; + string topic = 2; + SetQuery query = 3; +} + +// ClientDel delete messages or topic +message ClientDel { + string id = 1; + string topic = 2; + // What to delete, either "msg" to delete messages (default) or "topic" to delete the topic or "sub" + // to delete a subscription to topic. + enum What { + MSG = 0; + TOPIC = 1; + SUB = 2; + } + What what = 3; + // Delete messages older than this seq ID (inclusive) + int32 before = 4; + // List of Seq Ids to delete/mark as deleted + repeated int32 seq_list = 5; + // User ID of the subscription to delete + string user_id = 6; + // Request to hard-delete messages for all users, if such option is available. + bool hard = 7; +} + +enum InfoNote { + READ = 0; + RECV = 1; + KP = 2; +} + +// ClientNote is a client-generated notification for topic subscribers +message ClientNote { + string topic = 1; + // what is being reported: "recv" - message received, "read" - message read, "kp" - typing notification + InfoNote what = 2; + // Server-issued message ID being reported + int32 seq_id = 3; +} + +message ClientMsg { + oneof Message { + ClientHi hi = 1; + ClientAcc acc = 2; + ClientLogin login = 3; + ClientSub sub = 4; + ClientLeave leave = 5; + ClientPub pub = 6; + ClientGet get = 7; + ClientSet set = 8; + ClientDel del = 9; + ClientNote note = 10; + } +} + +// ************************ +// Server response messages + +// Topic description, S2C in Meta message +message TopicDesc { + int64 created_at = 1; + int64 updated_at = 2; + DefaultAcsMode defacs = 4; + AccessMode acs = 5; + int32 seq_id = 6; + int32 read_id = 7; + int32 recv_id = 8; + int32 clear_id = 9; + bytes public = 10; + bytes private = 11; +} + +// MsgTopicSub: topic subscription details, sent in Meta message +message TopicSub { + int64 updated_at = 1; + int64 deleted_at = 2; + + bool online = 3; + + AccessMode acs = 4; + int32 read_id = 5; + int32 recv_id = 6; + bytes public = 7; + bytes private = 8; + + // Response to non-'me' topic + + // Uid of the subscribed user + string user_id = 9; + + // 'me' topic only + + // Topic name of this subscription + string topic = 10; + // ID of the last {data} message in a topic + int32 seq_id = 11; + // Messages are deleted up to this ID + int32 clear_id = 12; + + // P2P topics only: + + // Other user's last online timestamp & user agent + int64 last_seen_time = 13; + string last_seen_user_agent = 14; +} + +// {ctrl} message +message ServerCtrl { + string id = 1; + int32 code = 2; + string text = 3; + map params = 4; +} + +// {data} message +message ServerData { + string topic = 1; + // ID of the user who originated the message as {pub}, could be empty if sent by the system + string from_user_id = 2; + // Timestamp when the message was deleted or 0. Milliseconds since the epoch 01/01/1970 + int64 deleted_at = 3; + int32 seq_id = 4; + map head = 5; + bytes content = 6; +} + +// {pres} message +message ServerPres { + string topic = 1; + string src = 2; + enum What { + ON = 0; + OFF = 1; + UA = 3; + UPD = 4; + GONE = 5; + ACS = 6; + TERM = 7; + MSG = 8; + READ = 9; + RECV = 10; + DEL = 11; + } + What what = 3; + string user_agent = 4; + int32 seq_id = 5; + repeated int32 seq_list = 6; + string target_user_id = 7; + string actor_user_id = 8; + AccessMode acs = 9; +} + +// {meta} message +message ServerMeta { + string id = 1; + string topic = 2; + + TopicDesc desc = 3; + repeated TopicSub sub = 4; +} + +// {info} message: server-side copy of ClientNote with From added +message ServerInfo { + string topic = 1; + string from_user_id = 2; + InfoNote what = 3; + int32 seq_id = 4; +} + +// Cumulative message +message ServerMsg { + oneof Message { + ServerCtrl ctrl = 1; + ServerData data = 2; + ServerPres pres = 3; + ServerMeta meta = 4; + ServerInfo info = 5; + } +} + +// Context messages + +message Session { + string session_id = 1; + string user_id = 2; + enum AuthLevel { + NONE = 0; + ANON = 10; + AUTH = 20; + ROOT = 30; + } + AuthLevel auth_level = 3; + string remote_addr = 4; + string user_agent = 5; + string device_id = 6; + string language = 7; +} + +message Topic { + string name = 1; + string access_auth = 2; + string access_anon = 3; + bytes public = 4; + bytes private = 5; +} + +message User { + string id = 1; + string mode_want = 2; + string mode_given = 3; + bytes public = 4; +} + +message ClientReq { + ClientMsg msg = 1; + Session sess = 2; +} \ No newline at end of file