Takahiro Suzuki | 241c10e | 2020-12-17 20:17:57 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | //Package adaptercoreonu provides the utility for onu devices, flows and statistics |
| 18 | package adaptercoreonu |
| 19 | |
| 20 | import ( |
| 21 | gp "github.com/google/gopacket" |
| 22 | "github.com/opencord/omci-lib-go" |
| 23 | ) |
| 24 | |
| 25 | // MessageType - Message Protocol Type |
| 26 | type MessageType uint8 |
| 27 | |
| 28 | const ( |
| 29 | TestMsg MessageType = iota |
| 30 | OMCI |
| 31 | ) |
| 32 | |
| 33 | // String - Return the text representation of the message type based on integer |
| 34 | func (m MessageType) String() string { |
| 35 | names := [...]string{ |
| 36 | "TestMsg", |
| 37 | "OMCI", |
| 38 | } |
| 39 | return names[m] |
| 40 | } |
| 41 | |
| 42 | // Message - message type and data(OMCI) |
| 43 | type Message struct { |
| 44 | Type MessageType |
| 45 | Data interface{} |
| 46 | } |
| 47 | |
| 48 | //TestMessageType - message data for various events |
| 49 | type TestMessageType uint8 |
| 50 | |
| 51 | const ( |
| 52 | LoadMibTemplateOk TestMessageType = iota + 1 |
| 53 | LoadMibTemplateFailed |
| 54 | TimeOutOccurred |
| 55 | AbortMessageProcessing |
| 56 | ) |
| 57 | |
| 58 | //TestMessage - Struct to hold the message data |
| 59 | //TODO: place holder to have a second interface variant - to be replaced by real variant later on |
| 60 | type TestMessage struct { |
| 61 | TestMessageVal TestMessageType |
| 62 | } |
| 63 | |
| 64 | //OmciMessage - OMCI protocol messages for managing and monitoring ONUs |
| 65 | type OmciMessage struct { |
| 66 | OmciMsg *omci.OMCI |
| 67 | OmciPacket *gp.Packet |
| 68 | } |