From 98c8caa28a02354c86ea5788c6d7a09e38147f79 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期三, 29 七月 2020 17:56:49 +0800 Subject: [PATCH] add alloc key --- library.go | 130 +++ softbus.proto | 46 + libcsoftbus.h | 3 softbus.pb.go | 1792 ++++++++++++++++++++++++++++++++++++++++++++++++++++ libcsoftbus_func.h | 5 softbus.go | 9 libcsoftbus.c | 8 7 files changed, 1,993 insertions(+), 0 deletions(-) diff --git a/libcsoftbus.c b/libcsoftbus.c index 1c02eaf..a5a23c1 100644 --- a/libcsoftbus.c +++ b/libcsoftbus.c @@ -57,6 +57,14 @@ fn_shm_init(size); } +int wrap_fn_shm_alloc_key(hcsoftbus lib){ + if (!fn_shm_alloc_key){ + fn_shm_alloc_key = (tfn_shm_alloc_key)dlsym(lib, l_shm_alloc_key); + check_with_ret(fn_shm_alloc_key, lib, -1); + } + return fn_shm_alloc_key(); +} + void wrap_fn_shm_destroy(hcsoftbus lib){ if (!fn_shm_destroy){ printf("shm destroy failed\n"); diff --git a/libcsoftbus.h b/libcsoftbus.h index 4e8a86c..1885b61 100644 --- a/libcsoftbus.h +++ b/libcsoftbus.h @@ -10,6 +10,7 @@ // shm manipulate static tfn_shm_init fn_shm_init = NULL; +static tfn_shm_alloc_key fn_shm_alloc_key = NULL; static tfn_shm_destroy fn_shm_destroy = NULL; static tfn_shm_rm_dead_queue fn_shm_rm_dead_queue = NULL; @@ -64,6 +65,7 @@ // labels // shm const static char l_shm_init[] = "shm_init"; +const static char l_shm_alloc_key[] = "shm_alloc_key"; const static char l_shm_destroy[] = "shm_destroy"; const static char l_shm_rm_dead_queue[] = "shm_remove_queues_exclude"; @@ -122,6 +124,7 @@ // shm manipulate void wrap_fn_shm_init(hcsoftbus lib, int size); +int wrap_fn_shm_alloc_key(hcsoftbus lib); void wrap_fn_shm_destroy(hcsoftbus lib); void wrap_fn_shm_rm_dead_queue(hcsoftbus lib, void *array, int len); diff --git a/libcsoftbus_func.h b/libcsoftbus_func.h index 5bd60dc..d921639 100644 --- a/libcsoftbus_func.h +++ b/libcsoftbus_func.h @@ -17,6 +17,11 @@ * 鏁翠釜杩涚▼閫�鍑烘椂闇�瑕佹墽琛岃繖涓柟娉曪紝璇ユ柟娉曢鍏堜細妫�鏌ユ槸鍚﹁繕鏈夊叾浠栬繘绋嬪湪浣跨敤璇ュ叡浜唴瀛橈紝濡傛灉杩樻湁鍏朵粬杩涚▼鍦ㄤ娇鐢ㄥ氨鍙槸detach,濡傛灉娌℃湁鍏朵粬杩涚▼鍦ㄤ娇鐢ㄥ垯閿�姣佹暣鍧楀唴瀛樸�� */ typedef void(*tfn_shm_destroy)(); +/** + * 鑾峰彇key + */ +typedef int(*tfn_shm_alloc_key) (); + //绉婚櫎涓嶅寘鍚湪keys涓殑闃熷垪 typedef void (*tfn_shm_rm_dead_queue)(void *keys, int length); diff --git a/library.go b/library.go new file mode 100644 index 0000000..e8b107c --- /dev/null +++ b/library.go @@ -0,0 +1,130 @@ +package softbus + +import ( + "fmt" + "time" + + "github.com/golang/protobuf/proto" +) + +const ( + // HeartbeatKey fixed key for hb to servermanager + HeartbeatKey = 11 + // RegKey fixed key for hb to servermanager + RegKey = 12 + // UpKey fixed key for update topic to servermanager + UpKey = 13 + // GetTopicInfoTypeTopic topic + GetTopicInfoTypeTopic = "gettopic" + // GetTopicInfoTypeChannel channel + GetTopicInfoTypeChannel = "getchannel" +) + +type shmKeyAndProcInfo struct { + sock *DgramSocket + info *ProcInfo +} + +// Handle handler +type Handle struct { + m map[string]*shmKeyAndProcInfo + sockWorker *DgramSocket +} + +// Register reg +func Register(info *RegisterInfo) *Handle { + m := make(map[string]*shmKeyAndProcInfo) + + // 棣栧厛璇锋眰涓�鍫唊ey + sockReg := OpenDgramSocket() + if sockReg == nil { + return nil + } + var msg, rdata []byte + var err error + for { + if msg == nil { + if msg, err = proto.Marshal(info); err != nil { + time.Sleep(100 * time.Millisecond) + continue + } + } + if rdata, err = sockReg.SendAndRecv(msg, RegKey); err == nil { + break + } + time.Sleep(100 * time.Millisecond) + } + sockReg.Close() + // 寰楀埌key,璧嬪�� + if rdata != nil { + + } + // 鍙敹涓嶅彂 + for _, v := range info.Channel { + s := OpenDgramSocket() + m[v] = &shmKeyAndProcInfo{ + sock: s, + info: info.ProcInfo, + } + } + + // pub/sub浣跨敤鍚屼竴涓猻ocket + pbs := OpenDgramSocket() + for _, v := range info.PubTopic { + m[v] = &shmKeyAndProcInfo{ + sock: pbs, + info: info.ProcInfo, + } + } + for _, v := range info.SubTopic { + m[v] = &shmKeyAndProcInfo{ + sock: pbs, + info: info.ProcInfo, + } + } + + s := OpenDgramSocket() + return &Handle{ + m: m, + sockWorker: s, + } +} + +// GetTopicInfo get topic info +func (h *Handle) GetTopicInfo(topic, typ string) int { + if v, ok := h.m[topic]; ok { + return v.sock.Port() + } + return -1 +} + +func (h *Handle) send2(data []byte, key int, logID string) error { + if r := h.sockWorker.SendTo(data, key); r != 0 { + return fmt.Errorf("%s SendTo Failed: %d", logID, r) + } + return nil +} + +// HeartBeat hb +func (h *Handle) HeartBeat(info *HeartbeatInfo) error { + msg, err := proto.Marshal(info) + if err == nil { + return h.send2(msg, HeartbeatKey, "HeartBeat") + } + return err +} + +// SendOnly no recv +func (h *Handle) SendOnly(key int, info *MsgInfo) error { + msg, err := proto.Marshal(info) + if err == nil { + return h.send2(msg, key, "SendOnly/Pub") + } + return err +} + +// Pub func +func (h *Handle) Pub(info *MsgInfo) error { + // return h.SendOnly(PubKey, info) + return nil +} diff --git a/softbus.go b/softbus.go index 6071e89..520176f 100644 --- a/softbus.go +++ b/softbus.go @@ -54,6 +54,15 @@ return nil } +// ShmAllocKey alloc key +func ShmAllocKey() int { + if libsoftbus == nil { + return -1 + } + r := C.wrap_fn_shm_alloc_key(libsoftbus) + return int(r) +} + // ShmDestroy destroy shm block, every softbus proc MUST call it func ShmDestroy() { if libsoftbus != nil { diff --git a/softbus.pb.go b/softbus.pb.go new file mode 100644 index 0000000..58be890 --- /dev/null +++ b/softbus.pb.go @@ -0,0 +1,1792 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: softbus.proto + +package softbus + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" +) + +// 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 ProcInfo struct { + ServerID string `protobuf:"bytes,1,opt,name=serverID,proto3" json:"serverID,omitempty"` + BoardID string `protobuf:"bytes,2,opt,name=boardID,proto3" json:"boardID,omitempty"` + ServerIP string `protobuf:"bytes,3,opt,name=serverIP,proto3" json:"serverIP,omitempty"` + ProcName string `protobuf:"bytes,4,opt,name=procName,proto3" json:"procName,omitempty"` + ProcID string `protobuf:"bytes,5,opt,name=procID,proto3" json:"procID,omitempty"` + ProcLabel string `protobuf:"bytes,6,opt,name=procLabel,proto3" json:"procLabel,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProcInfo) Reset() { *m = ProcInfo{} } +func (m *ProcInfo) String() string { return proto.CompactTextString(m) } +func (*ProcInfo) ProtoMessage() {} +func (*ProcInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_61abf516b68179fd, []int{0} +} +func (m *ProcInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProcInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProcInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProcInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProcInfo.Merge(m, src) +} +func (m *ProcInfo) XXX_Size() int { + return m.Size() +} +func (m *ProcInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ProcInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ProcInfo proto.InternalMessageInfo + +func (m *ProcInfo) GetServerID() string { + if m != nil { + return m.ServerID + } + return "" +} + +func (m *ProcInfo) GetBoardID() string { + if m != nil { + return m.BoardID + } + return "" +} + +func (m *ProcInfo) GetServerIP() string { + if m != nil { + return m.ServerIP + } + return "" +} + +func (m *ProcInfo) GetProcName() string { + if m != nil { + return m.ProcName + } + return "" +} + +func (m *ProcInfo) GetProcID() string { + if m != nil { + return m.ProcID + } + return "" +} + +func (m *ProcInfo) GetProcLabel() string { + if m != nil { + return m.ProcLabel + } + return "" +} + +type RegisterInfo struct { + ProcInfo *ProcInfo `protobuf:"bytes,1,opt,name=procInfo,proto3" json:"procInfo,omitempty"` + Channel []string `protobuf:"bytes,2,rep,name=channel,proto3" json:"channel,omitempty"` + PubTopic []string `protobuf:"bytes,3,rep,name=pubTopic,proto3" json:"pubTopic,omitempty"` + SubTopic []string `protobuf:"bytes,4,rep,name=subTopic,proto3" json:"subTopic,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RegisterInfo) Reset() { *m = RegisterInfo{} } +func (m *RegisterInfo) String() string { return proto.CompactTextString(m) } +func (*RegisterInfo) ProtoMessage() {} +func (*RegisterInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_61abf516b68179fd, []int{1} +} +func (m *RegisterInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RegisterInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterInfo.Merge(m, src) +} +func (m *RegisterInfo) XXX_Size() int { + return m.Size() +} +func (m *RegisterInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterInfo proto.InternalMessageInfo + +func (m *RegisterInfo) GetProcInfo() *ProcInfo { + if m != nil { + return m.ProcInfo + } + return nil +} + +func (m *RegisterInfo) GetChannel() []string { + if m != nil { + return m.Channel + } + return nil +} + +func (m *RegisterInfo) GetPubTopic() []string { + if m != nil { + return m.PubTopic + } + return nil +} + +func (m *RegisterInfo) GetSubTopic() []string { + if m != nil { + return m.SubTopic + } + return nil +} + +type HeartbeatInfo struct { + HealthLevel string `protobuf:"bytes,1,opt,name=healthLevel,proto3" json:"healthLevel,omitempty"` + Fps int32 `protobuf:"varint,2,opt,name=fps,proto3" json:"fps,omitempty"` + WarnInfo string `protobuf:"bytes,3,opt,name=warnInfo,proto3" json:"warnInfo,omitempty"` + ErrorInfo string `protobuf:"bytes,4,opt,name=errorInfo,proto3" json:"errorInfo,omitempty"` + OtherInfo []byte `protobuf:"bytes,5,opt,name=otherInfo,proto3" json:"otherInfo,omitempty"` + OtherInfoSize int32 `protobuf:"varint,6,opt,name=otherInfoSize,proto3" json:"otherInfoSize,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeartbeatInfo) Reset() { *m = HeartbeatInfo{} } +func (m *HeartbeatInfo) String() string { return proto.CompactTextString(m) } +func (*HeartbeatInfo) ProtoMessage() {} +func (*HeartbeatInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_61abf516b68179fd, []int{2} +} +func (m *HeartbeatInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeartbeatInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HeartbeatInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HeartbeatInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeartbeatInfo.Merge(m, src) +} +func (m *HeartbeatInfo) XXX_Size() int { + return m.Size() +} +func (m *HeartbeatInfo) XXX_DiscardUnknown() { + xxx_messageInfo_HeartbeatInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_HeartbeatInfo proto.InternalMessageInfo + +func (m *HeartbeatInfo) GetHealthLevel() string { + if m != nil { + return m.HealthLevel + } + return "" +} + +func (m *HeartbeatInfo) GetFps() int32 { + if m != nil { + return m.Fps + } + return 0 +} + +func (m *HeartbeatInfo) GetWarnInfo() string { + if m != nil { + return m.WarnInfo + } + return "" +} + +func (m *HeartbeatInfo) GetErrorInfo() string { + if m != nil { + return m.ErrorInfo + } + return "" +} + +func (m *HeartbeatInfo) GetOtherInfo() []byte { + if m != nil { + return m.OtherInfo + } + return nil +} + +func (m *HeartbeatInfo) GetOtherInfoSize() int32 { + if m != nil { + return m.OtherInfoSize + } + return 0 +} + +type MsgInfo struct { + SrcProc *ProcInfo `protobuf:"bytes,1,opt,name=srcProc,proto3" json:"srcProc,omitempty"` + MsgType string `protobuf:"bytes,2,opt,name=msgType,proto3" json:"msgType,omitempty"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + ShmKey int32 `protobuf:"varint,4,opt,name=shmKey,proto3" json:"shmKey,omitempty"` + Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` + BodyLen int32 `protobuf:"varint,6,opt,name=bodyLen,proto3" json:"bodyLen,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgInfo) Reset() { *m = MsgInfo{} } +func (m *MsgInfo) String() string { return proto.CompactTextString(m) } +func (*MsgInfo) ProtoMessage() {} +func (*MsgInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_61abf516b68179fd, []int{3} +} +func (m *MsgInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInfo.Merge(m, src) +} +func (m *MsgInfo) XXX_Size() int { + return m.Size() +} +func (m *MsgInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInfo proto.InternalMessageInfo + +func (m *MsgInfo) GetSrcProc() *ProcInfo { + if m != nil { + return m.SrcProc + } + return nil +} + +func (m *MsgInfo) GetMsgType() string { + if m != nil { + return m.MsgType + } + return "" +} + +func (m *MsgInfo) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *MsgInfo) GetShmKey() int32 { + if m != nil { + return m.ShmKey + } + return 0 +} + +func (m *MsgInfo) GetBody() []byte { + if m != nil { + return m.Body + } + return nil +} + +func (m *MsgInfo) GetBodyLen() int32 { + if m != nil { + return m.BodyLen + } + return 0 +} + +func init() { + proto.RegisterType((*ProcInfo)(nil), "softbus.ProcInfo") + proto.RegisterType((*RegisterInfo)(nil), "softbus.RegisterInfo") + proto.RegisterType((*HeartbeatInfo)(nil), "softbus.HeartbeatInfo") + proto.RegisterType((*MsgInfo)(nil), "softbus.MsgInfo") +} + +func init() { proto.RegisterFile("softbus.proto", fileDescriptor_61abf516b68179fd) } + +var fileDescriptor_61abf516b68179fd = []byte{ + // 411 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8e, 0xd3, 0x30, + 0x14, 0x86, 0xf1, 0xa4, 0x69, 0x66, 0x3c, 0xad, 0x54, 0x2c, 0x84, 0x2c, 0x84, 0xa2, 0x2a, 0x62, + 0x81, 0x84, 0xe8, 0x02, 0x6e, 0x80, 0xba, 0x20, 0xa2, 0xa0, 0x2a, 0xf4, 0x02, 0x4e, 0xfa, 0xda, + 0x54, 0x4a, 0xe3, 0xc8, 0x76, 0x8b, 0xc2, 0x25, 0xd8, 0x72, 0x08, 0xc4, 0x1d, 0xd8, 0xb1, 0xe4, + 0x08, 0xa8, 0x5c, 0x04, 0xf9, 0xc5, 0x4e, 0xdb, 0xc5, 0xec, 0xde, 0xf7, 0xff, 0xb1, 0xfc, 0xfe, + 0x3f, 0xa6, 0x63, 0x2d, 0x37, 0x26, 0x3f, 0xe8, 0x59, 0xa3, 0xa4, 0x91, 0x2c, 0x72, 0x98, 0xfc, + 0x24, 0xf4, 0x76, 0xa9, 0x64, 0x91, 0xd6, 0x1b, 0xc9, 0x9e, 0xd1, 0x5b, 0x0d, 0xea, 0x08, 0x2a, + 0x9d, 0x73, 0x32, 0x25, 0x2f, 0xef, 0xb2, 0x9e, 0x19, 0xa7, 0x51, 0x2e, 0x85, 0x5a, 0xa7, 0x73, + 0x7e, 0x83, 0x96, 0xc7, 0x8b, 0x53, 0x4b, 0x1e, 0x5c, 0x9d, 0x5a, 0x5a, 0xaf, 0x51, 0xb2, 0xf8, + 0x24, 0xf6, 0xc0, 0x07, 0x9d, 0xe7, 0x99, 0x3d, 0xa5, 0x43, 0x3b, 0xa7, 0x73, 0x1e, 0xa2, 0xe3, + 0x88, 0x3d, 0xa7, 0x77, 0x76, 0x5a, 0x88, 0x1c, 0x2a, 0x3e, 0x44, 0xeb, 0x2c, 0x24, 0xdf, 0x08, + 0x1d, 0x65, 0xb0, 0xdd, 0x69, 0x03, 0x0a, 0x97, 0x7e, 0xdd, 0x5d, 0x61, 0x67, 0x5c, 0xfa, 0xfe, + 0xcd, 0xe3, 0x99, 0x0f, 0xeb, 0x93, 0x65, 0xfd, 0x27, 0x36, 0x47, 0x51, 0x8a, 0xba, 0x86, 0x8a, + 0xdf, 0x4c, 0x03, 0x9b, 0xc3, 0x21, 0xee, 0x7a, 0xc8, 0x57, 0xb2, 0xd9, 0x15, 0x3c, 0x40, 0xab, + 0x67, 0xcc, 0xe8, 0xbd, 0x41, 0xe7, 0x79, 0x4e, 0x7e, 0x11, 0x3a, 0x7e, 0x0f, 0x42, 0x99, 0x1c, + 0x84, 0xc1, 0x3b, 0xa6, 0xf4, 0xbe, 0x04, 0x51, 0x99, 0x72, 0x01, 0x47, 0xa8, 0x5c, 0x95, 0x97, + 0x12, 0x9b, 0xd0, 0x60, 0xd3, 0x68, 0x6c, 0x32, 0xcc, 0xec, 0x68, 0x6f, 0xf8, 0x22, 0x54, 0x8d, + 0x31, 0x5c, 0x8b, 0x9e, 0x6d, 0x23, 0xa0, 0x94, 0xc4, 0xbc, 0xae, 0xc6, 0xb3, 0x60, 0x5d, 0x69, + 0xca, 0xae, 0x0d, 0xac, 0x72, 0x94, 0x9d, 0x05, 0xf6, 0x82, 0x8e, 0x7b, 0xf8, 0xbc, 0xfb, 0x0a, + 0xd8, 0x68, 0x98, 0x5d, 0x8b, 0xc9, 0x0f, 0x42, 0xa3, 0x8f, 0x7a, 0x8b, 0x27, 0x5e, 0xd1, 0x48, + 0xab, 0xc2, 0x56, 0xf7, 0x70, 0x9f, 0xfe, 0x0b, 0x5b, 0xe7, 0x5e, 0x6f, 0x57, 0x6d, 0x03, 0xfe, + 0x59, 0x38, 0x64, 0x4f, 0x68, 0x68, 0x5c, 0x97, 0x56, 0xef, 0xc0, 0xfe, 0x74, 0x5d, 0xee, 0x3f, + 0x40, 0x8b, 0x39, 0xc2, 0xcc, 0x11, 0x63, 0x74, 0x90, 0xcb, 0x75, 0xeb, 0xf6, 0xc7, 0xb9, 0x7b, + 0x72, 0xeb, 0x76, 0x01, 0xb5, 0x5b, 0xda, 0xe3, 0xbb, 0xc9, 0xef, 0x53, 0x4c, 0xfe, 0x9c, 0x62, + 0xf2, 0xf7, 0x14, 0x93, 0xef, 0xff, 0xe2, 0x47, 0xf9, 0x10, 0xdf, 0xf5, 0xdb, 0xff, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x70, 0x98, 0xf7, 0xf6, 0xe8, 0x02, 0x00, 0x00, +} + +func (m *ProcInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProcInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ServerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ServerID))) + i += copy(dAtA[i:], m.ServerID) + } + if len(m.BoardID) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.BoardID))) + i += copy(dAtA[i:], m.BoardID) + } + if len(m.ServerIP) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ServerIP))) + i += copy(dAtA[i:], m.ServerIP) + } + if len(m.ProcName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ProcName))) + i += copy(dAtA[i:], m.ProcName) + } + if len(m.ProcID) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ProcID))) + i += copy(dAtA[i:], m.ProcID) + } + if len(m.ProcLabel) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ProcLabel))) + i += copy(dAtA[i:], m.ProcLabel) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegisterInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisterInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ProcInfo != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.ProcInfo.Size())) + n1, err1 := m.ProcInfo.MarshalTo(dAtA[i:]) + if err1 != nil { + return 0, err1 + } + i += n1 + } + if len(m.Channel) > 0 { + for _, s := range m.Channel { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.PubTopic) > 0 { + for _, s := range m.PubTopic { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.SubTopic) > 0 { + for _, s := range m.SubTopic { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HeartbeatInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HeartbeatInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.HealthLevel) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.HealthLevel))) + i += copy(dAtA[i:], m.HealthLevel) + } + if m.Fps != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.Fps)) + } + if len(m.WarnInfo) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.WarnInfo))) + i += copy(dAtA[i:], m.WarnInfo) + } + if len(m.ErrorInfo) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.ErrorInfo))) + i += copy(dAtA[i:], m.ErrorInfo) + } + if len(m.OtherInfo) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.OtherInfo))) + i += copy(dAtA[i:], m.OtherInfo) + } + if m.OtherInfoSize != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.OtherInfoSize)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *MsgInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.SrcProc != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.SrcProc.Size())) + n2, err2 := m.SrcProc.MarshalTo(dAtA[i:]) + if err2 != nil { + return 0, err2 + } + i += n2 + } + if len(m.MsgType) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.MsgType))) + i += copy(dAtA[i:], m.MsgType) + } + if len(m.Topic) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.Topic))) + i += copy(dAtA[i:], m.Topic) + } + if m.ShmKey != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.ShmKey)) + } + if len(m.Body) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(len(m.Body))) + i += copy(dAtA[i:], m.Body) + } + if m.BodyLen != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintSoftbus(dAtA, i, uint64(m.BodyLen)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintSoftbus(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ProcInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServerID) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.BoardID) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.ServerIP) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.ProcName) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.ProcID) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.ProcLabel) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegisterInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProcInfo != nil { + l = m.ProcInfo.Size() + n += 1 + l + sovSoftbus(uint64(l)) + } + if len(m.Channel) > 0 { + for _, s := range m.Channel { + l = len(s) + n += 1 + l + sovSoftbus(uint64(l)) + } + } + if len(m.PubTopic) > 0 { + for _, s := range m.PubTopic { + l = len(s) + n += 1 + l + sovSoftbus(uint64(l)) + } + } + if len(m.SubTopic) > 0 { + for _, s := range m.SubTopic { + l = len(s) + n += 1 + l + sovSoftbus(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeartbeatInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.HealthLevel) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + if m.Fps != 0 { + n += 1 + sovSoftbus(uint64(m.Fps)) + } + l = len(m.WarnInfo) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.ErrorInfo) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.OtherInfo) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + if m.OtherInfoSize != 0 { + n += 1 + sovSoftbus(uint64(m.OtherInfoSize)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *MsgInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SrcProc != nil { + l = m.SrcProc.Size() + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.MsgType) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + l = len(m.Topic) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + if m.ShmKey != 0 { + n += 1 + sovSoftbus(uint64(m.ShmKey)) + } + l = len(m.Body) + if l > 0 { + n += 1 + l + sovSoftbus(uint64(l)) + } + if m.BodyLen != 0 { + n += 1 + sovSoftbus(uint64(m.BodyLen)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSoftbus(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSoftbus(x uint64) (n int) { + return sovSoftbus(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ProcInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProcInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProcInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BoardID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BoardID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServerIP", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerIP = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProcName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProcName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProcID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProcID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProcLabel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProcLabel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSoftbus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegisterInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProcInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProcInfo == nil { + m.ProcInfo = &ProcInfo{} + } + if err := m.ProcInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Channel = append(m.Channel, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubTopic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubTopic = append(m.PubTopic, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubTopic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SubTopic = append(m.SubTopic, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSoftbus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HeartbeatInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HeartbeatInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeartbeatInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HealthLevel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HealthLevel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Fps", wireType) + } + m.Fps = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Fps |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WarnInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WarnInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorInfo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OtherInfo", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OtherInfo = append(m.OtherInfo[:0], dAtA[iNdEx:postIndex]...) + if m.OtherInfo == nil { + m.OtherInfo = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OtherInfoSize", wireType) + } + m.OtherInfoSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OtherInfoSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSoftbus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcProc", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SrcProc == nil { + m.SrcProc = &ProcInfo{} + } + if err := m.SrcProc.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MsgType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topic = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ShmKey", wireType) + } + m.ShmKey = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ShmKey |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSoftbus + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSoftbus + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...) + if m.Body == nil { + m.Body = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BodyLen", wireType) + } + m.BodyLen = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSoftbus + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BodyLen |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSoftbus(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSoftbus + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSoftbus(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSoftbus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSoftbus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSoftbus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSoftbus + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthSoftbus + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSoftbus + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSoftbus(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthSoftbus + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSoftbus = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSoftbus = fmt.Errorf("proto: integer overflow") +) diff --git a/softbus.proto b/softbus.proto new file mode 100644 index 0000000..edf0bac --- /dev/null +++ b/softbus.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package softbus; + +// 杩涚▼鍩烘湰淇℃伅 +message ProcInfo{ + string serverID = 1;// 鏈哄櫒ID + string boardID = 2;// 鏉垮崱ID + string serverIP = 3;// 鏈哄櫒IP + string procName = 4;// 杩涚▼鍚嶇О + string procID = 5;// 杩涚▼鍞竴鏍囪瘑 + string procLabel = 6;// 杩涚▼鐨勬弿杩颁俊鎭紝鐢ㄤ簬鍖哄垎鍚屼竴杩涚▼鍚嶇О涓嬪涓繘绋� +} + +message RegisterInfo{ + ProcInfo procInfo = 1;// 杩涚▼鐨勪俊鎭� + repeated string channel = 2;// 鏂板棰戦亾锛屽搴斾竴涓柊鐨勫叡浜唴瀛橀槦鍒� + repeated string pubTopic = 3;// 杩涚▼瀵瑰鍙戝竷鐨勬湇鍔′富棰� + repeated string subTopic = 4;// 杩涚▼璁㈤槄鐨勬湇鍔′富棰� +} + +message RegisterInfoReply{ + ProcInfo procInfo = 1;//杩涚▼淇℃伅 + map<string, int32> channelKey = 2; + int32 heartbeatKey = 3; + int32 subTopicKey = 4; + int32 updateTopicKey = 5; +} + +message HeartbeatInfo { + string healthLevel = 1;// 鍋ュ悍绛夌骇 + int32 fps = 2;// 澶勭悊甯х巼(dec瑙g爜甯х巼銆乻dk澶勭悊甯х巼) + string warnInfo = 3;// 鎶ヨ淇℃伅 + string errorInfo = 4;// 閿欒淇℃伅 + bytes otherInfo = 5;// 鍏朵粬鐗规湁淇℃伅锛屽鏈夐渶瑕佸氨鐢ㄨ繖涓� + int32 otherInfoSize = 6;// 鍏朵粬鐗规湁淇℃伅闀垮害 +} + +message MsgInfo{ + ProcInfo srcProc = 1;// 婧愯繘绋嬪熀鏈俊鎭� + string msgType = 2;// 鏁版嵁绫诲瀷锛屽彲涓鸿姹傘�佸彂甯冦�佽闃呫�佸簲绛旂瓑 + string topic = 3;// 鏈嶅姟涓婚 + int32 shmKey = 4;// 璇锋眰搴旂瓟鏁版嵁浣跨敤鐨刱ey锛屽叾浠栨暟鎹笉鐢紝寰呯‘璁� + bytes body = 5;// 鏁版嵁鍐呭锛屼簩杩涘埗缂栫爜鍚庣殑锛岄渶瑕佺‘瀹氱紪鐮佺被鍨嬪苟瑙g爜 + int32 bodyLen = 6;// 鏁版嵁闀垮害 +} \ No newline at end of file -- Gitblit v1.8.0