From c4155a19e7bf5b2fc101dba45f51c174c6a34ac9 Mon Sep 17 00:00:00 2001 From: Gerson Graciani Date: Thu, 11 Feb 2016 07:56:14 +0000 Subject: [PATCH] Added Google Protocol Buffer proto3 --- main.go | 14 +- protocol/goping.go | 494 ++++++++++++++++++++++++++++++++++++++++++ protocol/goping.proto | 67 ++++++ 3 files changed, 573 insertions(+), 2 deletions(-) create mode 100644 protocol/goping.go create mode 100644 protocol/goping.proto diff --git a/main.go b/main.go index 743392f..158d2ed 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,17 @@ package main -import "fmt" +import ( + "fmt" + + "github.com/gersongraciani/goping/protocol" +) func main() { - fmt.Println("goping. Still in development phase.") + im := protocol.IcmpMessage{} + im.Identifier = 2 + im.Sequence = 1 + im.Type = protocol.IcmpMessage_ECHO_REPLY + im.Code = &protocol.IcmpMessage_SingleCode_{} + fmt.Printf("Not Yet Functional! .ICMP Message %#v\n", im) + } diff --git a/protocol/goping.go b/protocol/goping.go new file mode 100644 index 0000000..c07cbd9 --- /dev/null +++ b/protocol/goping.go @@ -0,0 +1,494 @@ +// Code generated by protoc-gen-go. +// source: goping.proto +// DO NOT EDIT! + +/* +Package protocol is a generated protocol buffer package. + +It is generated from these files: + goping.proto + +It has these top-level messages: + IcmpMessage +*/ +package protocol + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import 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. +const _ = proto.ProtoPackageIsVersion1 + +type IcmpMessage_Type int32 + +const ( + IcmpMessage_ECHO_REPLY IcmpMessage_Type = 0 + IcmpMessage_DESTINATION_UNREACHABLE IcmpMessage_Type = 3 + IcmpMessage_REDIRECT_MESSAGE IcmpMessage_Type = 5 + IcmpMessage_ECHO_REQUEST IcmpMessage_Type = 8 + IcmpMessage_ROUTER_ADVERTISEMENT IcmpMessage_Type = 9 + IcmpMessage_ROUTER_SOLICITATION IcmpMessage_Type = 10 + IcmpMessage_TIME_EXCEEDED IcmpMessage_Type = 11 + IcmpMessage_PARAMETER_PROBLEM IcmpMessage_Type = 12 + IcmpMessage_TIMESTAMP IcmpMessage_Type = 13 + IcmpMessage_TIMESTAMP_REPLY IcmpMessage_Type = 14 +) + +var IcmpMessage_Type_name = map[int32]string{ + 0: "ECHO_REPLY", + 3: "DESTINATION_UNREACHABLE", + 5: "REDIRECT_MESSAGE", + 8: "ECHO_REQUEST", + 9: "ROUTER_ADVERTISEMENT", + 10: "ROUTER_SOLICITATION", + 11: "TIME_EXCEEDED", + 12: "PARAMETER_PROBLEM", + 13: "TIMESTAMP", + 14: "TIMESTAMP_REPLY", +} +var IcmpMessage_Type_value = map[string]int32{ + "ECHO_REPLY": 0, + "DESTINATION_UNREACHABLE": 3, + "REDIRECT_MESSAGE": 5, + "ECHO_REQUEST": 8, + "ROUTER_ADVERTISEMENT": 9, + "ROUTER_SOLICITATION": 10, + "TIME_EXCEEDED": 11, + "PARAMETER_PROBLEM": 12, + "TIMESTAMP": 13, + "TIMESTAMP_REPLY": 14, +} + +func (x IcmpMessage_Type) String() string { + return proto.EnumName(IcmpMessage_Type_name, int32(x)) +} +func (IcmpMessage_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +type IcmpMessage_SingleCode int32 + +const ( + IcmpMessage_ZERO_CODE IcmpMessage_SingleCode = 0 +) + +var IcmpMessage_SingleCode_name = map[int32]string{ + 0: "ZERO_CODE", +} +var IcmpMessage_SingleCode_value = map[string]int32{ + "ZERO_CODE": 0, +} + +func (x IcmpMessage_SingleCode) String() string { + return proto.EnumName(IcmpMessage_SingleCode_name, int32(x)) +} +func (IcmpMessage_SingleCode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 1} } + +type IcmpMessage_DestinationUnreachableCode int32 + +const ( + IcmpMessage_NETWORK_UNREACHABLE IcmpMessage_DestinationUnreachableCode = 0 + IcmpMessage_HOST_UNREACHABLE IcmpMessage_DestinationUnreachableCode = 1 + IcmpMessage_PROTOCOL_UNREACHABLE IcmpMessage_DestinationUnreachableCode = 2 + IcmpMessage_PORT_UNREACHABLE IcmpMessage_DestinationUnreachableCode = 3 + IcmpMessage_FRAGMENTATION_REQUIRED IcmpMessage_DestinationUnreachableCode = 4 + IcmpMessage_SOURCE_ROUTE_FAILED IcmpMessage_DestinationUnreachableCode = 5 + IcmpMessage_DESTINATION_NETWORK_UNKNOWN IcmpMessage_DestinationUnreachableCode = 6 + IcmpMessage_DESTINATION_HOST_UNKNOWN IcmpMessage_DestinationUnreachableCode = 7 + IcmpMessage_SOURCE_HOST_ISOLATED IcmpMessage_DestinationUnreachableCode = 8 + IcmpMessage_NETWORK_ADMINISTRATIVELY_PROHIBITED IcmpMessage_DestinationUnreachableCode = 9 + IcmpMessage_HOST_ADMINISTRATIVELY_PROHIBITED IcmpMessage_DestinationUnreachableCode = 10 + IcmpMessage_NETWORK_UNREACHABLE_TOS IcmpMessage_DestinationUnreachableCode = 11 + IcmpMessage_HOST_UNREACHABLE_TOS IcmpMessage_DestinationUnreachableCode = 12 + IcmpMessage_COMMUNICATION_ADMINISTRATIVELY_PROHIBITED IcmpMessage_DestinationUnreachableCode = 13 + IcmpMessage_HOST_PRECEDENCE_VIOLATION IcmpMessage_DestinationUnreachableCode = 14 + IcmpMessage_PRECEDENCE_CUTOFF_IN_EFFECT IcmpMessage_DestinationUnreachableCode = 15 +) + +var IcmpMessage_DestinationUnreachableCode_name = map[int32]string{ + 0: "NETWORK_UNREACHABLE", + 1: "HOST_UNREACHABLE", + 2: "PROTOCOL_UNREACHABLE", + 3: "PORT_UNREACHABLE", + 4: "FRAGMENTATION_REQUIRED", + 5: "SOURCE_ROUTE_FAILED", + 6: "DESTINATION_NETWORK_UNKNOWN", + 7: "DESTINATION_HOST_UNKNOWN", + 8: "SOURCE_HOST_ISOLATED", + 9: "NETWORK_ADMINISTRATIVELY_PROHIBITED", + 10: "HOST_ADMINISTRATIVELY_PROHIBITED", + 11: "NETWORK_UNREACHABLE_TOS", + 12: "HOST_UNREACHABLE_TOS", + 13: "COMMUNICATION_ADMINISTRATIVELY_PROHIBITED", + 14: "HOST_PRECEDENCE_VIOLATION", + 15: "PRECEDENCE_CUTOFF_IN_EFFECT", +} +var IcmpMessage_DestinationUnreachableCode_value = map[string]int32{ + "NETWORK_UNREACHABLE": 0, + "HOST_UNREACHABLE": 1, + "PROTOCOL_UNREACHABLE": 2, + "PORT_UNREACHABLE": 3, + "FRAGMENTATION_REQUIRED": 4, + "SOURCE_ROUTE_FAILED": 5, + "DESTINATION_NETWORK_UNKNOWN": 6, + "DESTINATION_HOST_UNKNOWN": 7, + "SOURCE_HOST_ISOLATED": 8, + "NETWORK_ADMINISTRATIVELY_PROHIBITED": 9, + "HOST_ADMINISTRATIVELY_PROHIBITED": 10, + "NETWORK_UNREACHABLE_TOS": 11, + "HOST_UNREACHABLE_TOS": 12, + "COMMUNICATION_ADMINISTRATIVELY_PROHIBITED": 13, + "HOST_PRECEDENCE_VIOLATION": 14, + "PRECEDENCE_CUTOFF_IN_EFFECT": 15, +} + +func (x IcmpMessage_DestinationUnreachableCode) String() string { + return proto.EnumName(IcmpMessage_DestinationUnreachableCode_name, int32(x)) +} +func (IcmpMessage_DestinationUnreachableCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 2} +} + +type IcmpMessage_RedirectMessageCode int32 + +const ( + IcmpMessage_REDIRECT_DATAGRAM_FOR_NETWORK IcmpMessage_RedirectMessageCode = 0 + IcmpMessage_REDIRECT_DATAGRAM_FOR_HOST IcmpMessage_RedirectMessageCode = 1 + IcmpMessage_REDIRECT_DATAGRAM_FOR_TOS_NETWORK IcmpMessage_RedirectMessageCode = 2 + IcmpMessage_REDIRECT_DATAGRAM_FOR_TOS_HOST IcmpMessage_RedirectMessageCode = 3 +) + +var IcmpMessage_RedirectMessageCode_name = map[int32]string{ + 0: "REDIRECT_DATAGRAM_FOR_NETWORK", + 1: "REDIRECT_DATAGRAM_FOR_HOST", + 2: "REDIRECT_DATAGRAM_FOR_TOS_NETWORK", + 3: "REDIRECT_DATAGRAM_FOR_TOS_HOST", +} +var IcmpMessage_RedirectMessageCode_value = map[string]int32{ + "REDIRECT_DATAGRAM_FOR_NETWORK": 0, + "REDIRECT_DATAGRAM_FOR_HOST": 1, + "REDIRECT_DATAGRAM_FOR_TOS_NETWORK": 2, + "REDIRECT_DATAGRAM_FOR_TOS_HOST": 3, +} + +func (x IcmpMessage_RedirectMessageCode) String() string { + return proto.EnumName(IcmpMessage_RedirectMessageCode_name, int32(x)) +} +func (IcmpMessage_RedirectMessageCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 3} +} + +type IcmpMessage_TimeExceededCode int32 + +const ( + IcmpMessage_TTL_EXPIRED_IN_TRANSIT IcmpMessage_TimeExceededCode = 0 + IcmpMessage_FRAGMENT_REASSEMBLY_TIME_EXCEEDED IcmpMessage_TimeExceededCode = 1 +) + +var IcmpMessage_TimeExceededCode_name = map[int32]string{ + 0: "TTL_EXPIRED_IN_TRANSIT", + 1: "FRAGMENT_REASSEMBLY_TIME_EXCEEDED", +} +var IcmpMessage_TimeExceededCode_value = map[string]int32{ + "TTL_EXPIRED_IN_TRANSIT": 0, + "FRAGMENT_REASSEMBLY_TIME_EXCEEDED": 1, +} + +func (x IcmpMessage_TimeExceededCode) String() string { + return proto.EnumName(IcmpMessage_TimeExceededCode_name, int32(x)) +} +func (IcmpMessage_TimeExceededCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 4} +} + +type IcmpMessage_ParameterProblemCode int32 + +const ( + IcmpMessage_POINTER_INDICATES_THE_ERROR IcmpMessage_ParameterProblemCode = 0 + IcmpMessage_MISSING_REQUIRED_OPTION IcmpMessage_ParameterProblemCode = 1 + IcmpMessage_BAD_LENGTH IcmpMessage_ParameterProblemCode = 2 +) + +var IcmpMessage_ParameterProblemCode_name = map[int32]string{ + 0: "POINTER_INDICATES_THE_ERROR", + 1: "MISSING_REQUIRED_OPTION", + 2: "BAD_LENGTH", +} +var IcmpMessage_ParameterProblemCode_value = map[string]int32{ + "POINTER_INDICATES_THE_ERROR": 0, + "MISSING_REQUIRED_OPTION": 1, + "BAD_LENGTH": 2, +} + +func (x IcmpMessage_ParameterProblemCode) String() string { + return proto.EnumName(IcmpMessage_ParameterProblemCode_name, int32(x)) +} +func (IcmpMessage_ParameterProblemCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{0, 5} +} + +type IcmpMessage struct { + Type IcmpMessage_Type `protobuf:"varint,1,opt,name=type,enum=protocol.IcmpMessage_Type" json:"type,omitempty"` + // Types that are valid to be assigned to Code: + // *IcmpMessage_SingleCode_ + // *IcmpMessage_DestinationUnreachableCode_ + // *IcmpMessage_RedirectMessageCode_ + // *IcmpMessage_TimeExceededCode_ + // *IcmpMessage_ParameterProblemCode_ + Code isIcmpMessage_Code `protobuf_oneof:"code"` + Identifier uint32 `protobuf:"varint,7,opt,name=identifier" json:"identifier,omitempty"` + Sequence uint32 `protobuf:"varint,8,opt,name=sequence" json:"sequence,omitempty"` + Payload []byte `protobuf:"bytes,9,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *IcmpMessage) Reset() { *m = IcmpMessage{} } +func (m *IcmpMessage) String() string { return proto.CompactTextString(m) } +func (*IcmpMessage) ProtoMessage() {} +func (*IcmpMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type isIcmpMessage_Code interface { + isIcmpMessage_Code() +} + +type IcmpMessage_SingleCode_ struct { + SingleCode IcmpMessage_SingleCode `protobuf:"varint,2,opt,name=singleCode,enum=protocol.IcmpMessage_SingleCode,oneof"` +} +type IcmpMessage_DestinationUnreachableCode_ struct { + DestinationUnreachableCode IcmpMessage_DestinationUnreachableCode `protobuf:"varint,3,opt,name=destinationUnreachableCode,enum=protocol.IcmpMessage_DestinationUnreachableCode,oneof"` +} +type IcmpMessage_RedirectMessageCode_ struct { + RedirectMessageCode IcmpMessage_RedirectMessageCode `protobuf:"varint,4,opt,name=redirectMessageCode,enum=protocol.IcmpMessage_RedirectMessageCode,oneof"` +} +type IcmpMessage_TimeExceededCode_ struct { + TimeExceededCode IcmpMessage_TimeExceededCode `protobuf:"varint,5,opt,name=timeExceededCode,enum=protocol.IcmpMessage_TimeExceededCode,oneof"` +} +type IcmpMessage_ParameterProblemCode_ struct { + ParameterProblemCode IcmpMessage_ParameterProblemCode `protobuf:"varint,6,opt,name=parameterProblemCode,enum=protocol.IcmpMessage_ParameterProblemCode,oneof"` +} + +func (*IcmpMessage_SingleCode_) isIcmpMessage_Code() {} +func (*IcmpMessage_DestinationUnreachableCode_) isIcmpMessage_Code() {} +func (*IcmpMessage_RedirectMessageCode_) isIcmpMessage_Code() {} +func (*IcmpMessage_TimeExceededCode_) isIcmpMessage_Code() {} +func (*IcmpMessage_ParameterProblemCode_) isIcmpMessage_Code() {} + +func (m *IcmpMessage) GetCode() isIcmpMessage_Code { + if m != nil { + return m.Code + } + return nil +} + +func (m *IcmpMessage) GetSingleCode() IcmpMessage_SingleCode { + if x, ok := m.GetCode().(*IcmpMessage_SingleCode_); ok { + return x.SingleCode + } + return IcmpMessage_ZERO_CODE +} + +func (m *IcmpMessage) GetDestinationUnreachableCode() IcmpMessage_DestinationUnreachableCode { + if x, ok := m.GetCode().(*IcmpMessage_DestinationUnreachableCode_); ok { + return x.DestinationUnreachableCode + } + return IcmpMessage_NETWORK_UNREACHABLE +} + +func (m *IcmpMessage) GetRedirectMessageCode() IcmpMessage_RedirectMessageCode { + if x, ok := m.GetCode().(*IcmpMessage_RedirectMessageCode_); ok { + return x.RedirectMessageCode + } + return IcmpMessage_REDIRECT_DATAGRAM_FOR_NETWORK +} + +func (m *IcmpMessage) GetTimeExceededCode() IcmpMessage_TimeExceededCode { + if x, ok := m.GetCode().(*IcmpMessage_TimeExceededCode_); ok { + return x.TimeExceededCode + } + return IcmpMessage_TTL_EXPIRED_IN_TRANSIT +} + +func (m *IcmpMessage) GetParameterProblemCode() IcmpMessage_ParameterProblemCode { + if x, ok := m.GetCode().(*IcmpMessage_ParameterProblemCode_); ok { + return x.ParameterProblemCode + } + return IcmpMessage_POINTER_INDICATES_THE_ERROR +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*IcmpMessage) 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 _IcmpMessage_OneofMarshaler, _IcmpMessage_OneofUnmarshaler, _IcmpMessage_OneofSizer, []interface{}{ + (*IcmpMessage_SingleCode_)(nil), + (*IcmpMessage_DestinationUnreachableCode_)(nil), + (*IcmpMessage_RedirectMessageCode_)(nil), + (*IcmpMessage_TimeExceededCode_)(nil), + (*IcmpMessage_ParameterProblemCode_)(nil), + } +} + +func _IcmpMessage_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*IcmpMessage) + // code + switch x := m.Code.(type) { + case *IcmpMessage_SingleCode_: + b.EncodeVarint(2<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.SingleCode)) + case *IcmpMessage_DestinationUnreachableCode_: + b.EncodeVarint(3<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.DestinationUnreachableCode)) + case *IcmpMessage_RedirectMessageCode_: + b.EncodeVarint(4<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.RedirectMessageCode)) + case *IcmpMessage_TimeExceededCode_: + b.EncodeVarint(5<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.TimeExceededCode)) + case *IcmpMessage_ParameterProblemCode_: + b.EncodeVarint(6<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.ParameterProblemCode)) + case nil: + default: + return fmt.Errorf("IcmpMessage.Code has unexpected type %T", x) + } + return nil +} + +func _IcmpMessage_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*IcmpMessage) + switch tag { + case 2: // code.singleCode + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Code = &IcmpMessage_SingleCode_{IcmpMessage_SingleCode(x)} + return true, err + case 3: // code.destinationUnreachableCode + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Code = &IcmpMessage_DestinationUnreachableCode_{IcmpMessage_DestinationUnreachableCode(x)} + return true, err + case 4: // code.redirectMessageCode + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Code = &IcmpMessage_RedirectMessageCode_{IcmpMessage_RedirectMessageCode(x)} + return true, err + case 5: // code.timeExceededCode + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Code = &IcmpMessage_TimeExceededCode_{IcmpMessage_TimeExceededCode(x)} + return true, err + case 6: // code.parameterProblemCode + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Code = &IcmpMessage_ParameterProblemCode_{IcmpMessage_ParameterProblemCode(x)} + return true, err + default: + return false, nil + } +} + +func _IcmpMessage_OneofSizer(msg proto.Message) (n int) { + m := msg.(*IcmpMessage) + // code + switch x := m.Code.(type) { + case *IcmpMessage_SingleCode_: + n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.SingleCode)) + case *IcmpMessage_DestinationUnreachableCode_: + n += proto.SizeVarint(3<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.DestinationUnreachableCode)) + case *IcmpMessage_RedirectMessageCode_: + n += proto.SizeVarint(4<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.RedirectMessageCode)) + case *IcmpMessage_TimeExceededCode_: + n += proto.SizeVarint(5<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.TimeExceededCode)) + case *IcmpMessage_ParameterProblemCode_: + n += proto.SizeVarint(6<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.ParameterProblemCode)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +func init() { + proto.RegisterType((*IcmpMessage)(nil), "protocol.IcmpMessage") + proto.RegisterEnum("protocol.IcmpMessage_Type", IcmpMessage_Type_name, IcmpMessage_Type_value) + proto.RegisterEnum("protocol.IcmpMessage_SingleCode", IcmpMessage_SingleCode_name, IcmpMessage_SingleCode_value) + proto.RegisterEnum("protocol.IcmpMessage_DestinationUnreachableCode", IcmpMessage_DestinationUnreachableCode_name, IcmpMessage_DestinationUnreachableCode_value) + proto.RegisterEnum("protocol.IcmpMessage_RedirectMessageCode", IcmpMessage_RedirectMessageCode_name, IcmpMessage_RedirectMessageCode_value) + proto.RegisterEnum("protocol.IcmpMessage_TimeExceededCode", IcmpMessage_TimeExceededCode_name, IcmpMessage_TimeExceededCode_value) + proto.RegisterEnum("protocol.IcmpMessage_ParameterProblemCode", IcmpMessage_ParameterProblemCode_name, IcmpMessage_ParameterProblemCode_value) +} + +var fileDescriptor0 = []byte{ + // 851 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x94, 0xff, 0x72, 0x1a, 0x37, + 0x10, 0xc7, 0x8d, 0x8d, 0x6d, 0xbc, 0x01, 0x47, 0x91, 0xdd, 0x86, 0xe2, 0xc6, 0x75, 0xe8, 0xcf, + 0x74, 0xa6, 0x4c, 0xa7, 0x7d, 0x82, 0xe3, 0x4e, 0x80, 0x26, 0x9c, 0x74, 0x95, 0x84, 0xd3, 0x74, + 0xa6, 0x73, 0x25, 0xa0, 0xba, 0xcc, 0xd8, 0x40, 0x8f, 0xeb, 0x4c, 0xf3, 0x3c, 0x7d, 0x9b, 0x3e, + 0x43, 0x9f, 0xa5, 0x93, 0x95, 0x0c, 0x04, 0x3b, 0x87, 0xff, 0x62, 0x8e, 0xdd, 0xfd, 0xec, 0xee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17, 0xdd, 0xb5, 0x65, 0x53, 0x99, 0x78, 0xcd, 0x4b, 0xee, 0x19, + 0x69, 0x07, 0x51, 0xda, 0x67, 0xa2, 0x6b, 0x7a, 0x64, 0xb7, 0x7d, 0x00, 0xe5, 0x11, 0x52, 0xdf, + 0x1c, 0xf8, 0x07, 0xf0, 0xc7, 0x77, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xb4, 0x3a, 0x7b, 0xed, + 0x06, 0x00, 0x00, +} diff --git a/protocol/goping.proto b/protocol/goping.proto new file mode 100644 index 0000000..8198e97 --- /dev/null +++ b/protocol/goping.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; + +package protocol; + +message IcmpMessage{ + enum Type{ + ECHO_REPLY = 0; + DESTINATION_UNREACHABLE = 3; + REDIRECT_MESSAGE = 5; + ECHO_REQUEST = 8; + ROUTER_ADVERTISEMENT = 9; + ROUTER_SOLICITATION = 10; + TIME_EXCEEDED = 11; + PARAMETER_PROBLEM = 12; + TIMESTAMP = 13; + TIMESTAMP_REPLY = 14; + } + enum SingleCode{ + ZERO_CODE = 0; + } + enum DestinationUnreachableCode{ + NETWORK_UNREACHABLE = 0; + HOST_UNREACHABLE = 1; + PROTOCOL_UNREACHABLE = 2; + PORT_UNREACHABLE = 3; + FRAGMENTATION_REQUIRED = 4; + SOURCE_ROUTE_FAILED = 5; + DESTINATION_NETWORK_UNKNOWN = 6; + DESTINATION_HOST_UNKNOWN = 7; + SOURCE_HOST_ISOLATED = 8; + NETWORK_ADMINISTRATIVELY_PROHIBITED = 9; + HOST_ADMINISTRATIVELY_PROHIBITED = 10; + NETWORK_UNREACHABLE_TOS = 11; + HOST_UNREACHABLE_TOS = 12; + COMMUNICATION_ADMINISTRATIVELY_PROHIBITED = 13; + HOST_PRECEDENCE_VIOLATION = 14; + PRECEDENCE_CUTOFF_IN_EFFECT = 15; + } + enum RedirectMessageCode{ + REDIRECT_DATAGRAM_FOR_NETWORK = 0; + REDIRECT_DATAGRAM_FOR_HOST = 1; + REDIRECT_DATAGRAM_FOR_TOS_NETWORK = 2; + REDIRECT_DATAGRAM_FOR_TOS_HOST = 3; + } + enum TimeExceededCode{ + TTL_EXPIRED_IN_TRANSIT = 0; + FRAGMENT_REASSEMBLY_TIME_EXCEEDED = 1; + } + enum ParameterProblemCode{ + POINTER_INDICATES_THE_ERROR = 0; + MISSING_REQUIRED_OPTION = 1; + BAD_LENGTH = 2; + } + + Type type = 1; + oneof code { + SingleCode singleCode = 2; + DestinationUnreachableCode destinationUnreachableCode = 3; + RedirectMessageCode redirectMessageCode = 4; + TimeExceededCode timeExceededCode = 5; + ParameterProblemCode parameterProblemCode = 6; + } + uint32 identifier = 7; + uint32 sequence = 8; + bytes payload = 9; + +}