diff --git a/graffiti/websocket/structmessage.pb.go b/graffiti/websocket/structmessage.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..faa18fde4136c0a9bca2dbab4ab2a9fbce71efd8 --- /dev/null +++ b/graffiti/websocket/structmessage.pb.go @@ -0,0 +1,580 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: graffiti/websocket/structmessage.proto + +package websocket + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Format int32 + +const ( + Format_Json Format = 0 + Format_Protobuf Format = 1 +) + +var Format_name = map[int32]string{ + 0: "Json", + 1: "Protobuf", +} + +var Format_value = map[string]int32{ + "Json": 0, + "Protobuf": 1, +} + +func (x Format) String() string { + return proto.EnumName(Format_name, int32(x)) +} + +func (Format) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8e9639977d76961c, []int{0} +} + +// StructMessage is a Protobuf based message on top of Message. +// It implements Message interface and can be sent with via a Speaker. +type StructMessage struct { + XXX_state structMessageState `json:"-"` + Namespace string `protobuf:"bytes,1,opt,name=Namespace,proto3" json:"Namespace,omitempty"` + Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` + UUID string `protobuf:"bytes,3,opt,name=UUID,proto3" json:"UUID,omitempty"` + Status int64 `protobuf:"varint,4,opt,name=Status,proto3" json:"Status,omitempty"` + Format Format `protobuf:"varint,5,opt,name=Format,proto3,enum=websocket.Format" json:"Format,omitempty"` + Obj []byte `protobuf:"bytes,6,opt,name=Obj,proto3" json:"Obj,omitempty"` +} + +func (m *StructMessage) Reset() { *m = StructMessage{} } +func (m *StructMessage) String() string { return proto.CompactTextString(m) } +func (*StructMessage) ProtoMessage() {} +func (*StructMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_8e9639977d76961c, []int{0} +} +func (m *StructMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StructMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StructMessage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StructMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StructMessage.Merge(m, src) +} +func (m *StructMessage) XXX_Size() int { + return m.ProtoSize() +} +func (m *StructMessage) XXX_DiscardUnknown() { + xxx_messageInfo_StructMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_StructMessage proto.InternalMessageInfo + +func (m *StructMessage) GetNamespace() string { + if m != nil { + return m.Namespace + } + return "" +} + +func (m *StructMessage) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *StructMessage) GetUUID() string { + if m != nil { + return m.UUID + } + return "" +} + +func (m *StructMessage) GetStatus() int64 { + if m != nil { + return m.Status + } + return 0 +} + +func (m *StructMessage) GetFormat() Format { + if m != nil { + return m.Format + } + return Format_Json +} + +func (m *StructMessage) GetObj() []byte { + if m != nil { + return m.Obj + } + return nil +} + +func init() { + proto.RegisterEnum("websocket.Format", Format_name, Format_value) + proto.RegisterType((*StructMessage)(nil), "websocket.StructMessage") +} + +func init() { + proto.RegisterFile("graffiti/websocket/structmessage.proto", fileDescriptor_8e9639977d76961c) +} + +var fileDescriptor_8e9639977d76961c = []byte{ + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0x2f, 0x4a, 0x4c, + 0x4b, 0xcb, 0x2c, 0xc9, 0xd4, 0x2f, 0x4f, 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 0x93, + 0xa4, 0xd2, 0x34, 0x01, 0x46, 0xa7, 0xe0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, + 0xf0, 0x48, 0x8e, 0x61, 0xc2, 0x63, 0x39, 0x86, 0x05, 0x8f, 0xe5, 0x18, 0x2f, 0x3c, 0x96, 0x63, + 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x34, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, + 0x57, 0xbf, 0x38, 0xbb, 0x32, 0x25, 0xb3, 0x2c, 0x55, 0xb7, 0xa0, 0x28, 0x3f, 0x2b, 0x35, 0xb9, + 0x04, 0xc6, 0xd7, 0xc7, 0x0c, 0xd8, 0x24, 0x36, 0x70, 0x50, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x36, 0xfa, 0x0c, 0xd5, 0x75, 0x01, 0x00, 0x00, +} + +func (m *StructMessage) Marshal() (dAtA []byte, err error) { + size := m.ProtoSize() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StructMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.ProtoSize() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StructMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Obj) > 0 { + i -= len(m.Obj) + copy(dAtA[i:], m.Obj) + i = encodeVarintStructmessage(dAtA, i, uint64(len(m.Obj))) + i-- + dAtA[i] = 0x32 + } + if m.Format != 0 { + i = encodeVarintStructmessage(dAtA, i, uint64(m.Format)) + i-- + dAtA[i] = 0x28 + } + if m.Status != 0 { + i = encodeVarintStructmessage(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if len(m.UUID) > 0 { + i -= len(m.UUID) + copy(dAtA[i:], m.UUID) + i = encodeVarintStructmessage(dAtA, i, uint64(len(m.UUID))) + i-- + dAtA[i] = 0x1a + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintStructmessage(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x12 + } + if len(m.Namespace) > 0 { + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintStructmessage(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintStructmessage(dAtA []byte, offset int, v uint64) int { + offset -= sovStructmessage(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StructMessage) ProtoSize() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Namespace) + if l > 0 { + n += 1 + l + sovStructmessage(uint64(l)) + } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovStructmessage(uint64(l)) + } + l = len(m.UUID) + if l > 0 { + n += 1 + l + sovStructmessage(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovStructmessage(uint64(m.Status)) + } + if m.Format != 0 { + n += 1 + sovStructmessage(uint64(m.Format)) + } + l = len(m.Obj) + if l > 0 { + n += 1 + l + sovStructmessage(uint64(l)) + } + return n +} + +func sovStructmessage(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStructmessage(x uint64) (n int) { + return sovStructmessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StructMessage) 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 ErrIntOverflowStructmessage + } + 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: StructMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StructMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + 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 ErrInvalidLengthStructmessage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStructmessage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + 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 ErrInvalidLengthStructmessage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStructmessage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UUID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + 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 ErrInvalidLengthStructmessage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStructmessage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UUID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Format", wireType) + } + m.Format = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Format |= Format(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Obj", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStructmessage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStructmessage + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStructmessage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Obj = append(m.Obj[:0], dAtA[iNdEx:postIndex]...) + if m.Obj == nil { + m.Obj = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStructmessage(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStructmessage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStructmessage(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStructmessage + } + 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, ErrIntOverflowStructmessage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStructmessage + } + 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, ErrInvalidLengthStructmessage + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStructmessage + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStructmessage + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStructmessage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStructmessage = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStructmessage = fmt.Errorf("proto: unexpected end of group") +) diff --git a/graffiti/websocket/structmessage.proto b/graffiti/websocket/structmessage.proto new file mode 100644 index 0000000000000000000000000000000000000000..f3e56e6927e3c9585369280787d3cb1c2b7e8d38 --- /dev/null +++ b/graffiti/websocket/structmessage.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package websocket; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/skydive-project/skydive/graffiti/websocket"; +option (gogoproto.protosizer_all) = true; +option (gogoproto.sizer_all) = false; + +enum Format { + Json = 0; + Protobuf = 1; +} + +// StructMessage is a Protobuf based message on top of Message. +// It implements Message interface and can be sent with via a Speaker. +message StructMessage { + string Namespace = 1; + string Type = 2; + string UUID = 3; + int64 Status = 4; + Format Format = 5; + bytes Obj = 6; +}