Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019-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 org.onosproject.p4runtime.ctl.codec; |
| 18 | |
| 19 | /** |
| 20 | * Utility class that provides access to P4Runtime codec instances. |
| 21 | */ |
| 22 | public final class Codecs { |
| 23 | |
| 24 | public static final Codecs CODECS = new Codecs(); |
| 25 | |
| 26 | private final ActionCodec action; |
| 27 | private final ActionProfileGroupCodec actionProfileGroup; |
| 28 | private final ActionProfileMemberCodec actionProfileMember; |
| 29 | private final CounterEntryCodec counterEntry; |
| 30 | private final DirectCounterEntryCodec directCounterEntry; |
| 31 | private final DirectMeterEntryCodec directMeterEntry; |
| 32 | private final EntityCodec entity; |
| 33 | private final FieldMatchCodec fieldMatch; |
| 34 | private final HandleCodec handle; |
| 35 | private final MeterEntryCodec meterEntry; |
| 36 | private final MulticastGroupEntryCodec multicastGroupEntry; |
Carmelo Cascone | 9db4d5c | 2019-04-16 17:36:33 -0700 | [diff] [blame] | 37 | private final CloneSessionEntryCodec cloneSessionEntry; |
| 38 | private final PreReplicaCodec preReplica; |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 39 | private final PacketInCodec packetIn; |
| 40 | private final PacketMetadataCodec packetMetadata; |
| 41 | private final PacketOutCodec packetOut; |
| 42 | private final TableEntryCodec tableEntry; |
| 43 | |
| 44 | private Codecs() { |
| 45 | this.action = new ActionCodec(); |
| 46 | this.actionProfileGroup = new ActionProfileGroupCodec(); |
| 47 | this.actionProfileMember = new ActionProfileMemberCodec(); |
| 48 | this.counterEntry = new CounterEntryCodec(); |
| 49 | this.directCounterEntry = new DirectCounterEntryCodec(); |
| 50 | this.directMeterEntry = new DirectMeterEntryCodec(); |
| 51 | this.entity = new EntityCodec(); |
| 52 | this.fieldMatch = new FieldMatchCodec(); |
| 53 | this.handle = new HandleCodec(); |
| 54 | this.meterEntry = new MeterEntryCodec(); |
| 55 | this.multicastGroupEntry = new MulticastGroupEntryCodec(); |
Carmelo Cascone | 9db4d5c | 2019-04-16 17:36:33 -0700 | [diff] [blame] | 56 | this.cloneSessionEntry = new CloneSessionEntryCodec(); |
| 57 | this.preReplica = new PreReplicaCodec(); |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 58 | this.packetIn = new PacketInCodec(); |
| 59 | this.packetMetadata = new PacketMetadataCodec(); |
| 60 | this.packetOut = new PacketOutCodec(); |
| 61 | this.tableEntry = new TableEntryCodec(); |
| 62 | } |
| 63 | |
| 64 | public EntityCodec entity() { |
| 65 | return entity; |
| 66 | } |
| 67 | |
| 68 | public HandleCodec handle() { |
| 69 | return handle; |
| 70 | } |
| 71 | |
| 72 | public PacketOutCodec packetOut() { |
| 73 | return packetOut; |
| 74 | } |
| 75 | |
| 76 | public PacketInCodec packetIn() { |
| 77 | return packetIn; |
| 78 | } |
| 79 | |
| 80 | TableEntryCodec tableEntry() { |
| 81 | return tableEntry; |
| 82 | } |
| 83 | |
| 84 | FieldMatchCodec fieldMatch() { |
| 85 | return fieldMatch; |
| 86 | } |
| 87 | |
| 88 | ActionCodec action() { |
| 89 | return action; |
| 90 | } |
| 91 | |
| 92 | ActionProfileMemberCodec actionProfileMember() { |
| 93 | return actionProfileMember; |
| 94 | } |
| 95 | |
| 96 | ActionProfileGroupCodec actionProfileGroup() { |
| 97 | return actionProfileGroup; |
| 98 | } |
| 99 | |
| 100 | PacketMetadataCodec packetMetadata() { |
| 101 | return packetMetadata; |
| 102 | } |
| 103 | |
| 104 | MulticastGroupEntryCodec multicastGroupEntry() { |
| 105 | return multicastGroupEntry; |
| 106 | } |
| 107 | |
Carmelo Cascone | 9db4d5c | 2019-04-16 17:36:33 -0700 | [diff] [blame] | 108 | CloneSessionEntryCodec cloneSessionEntry() { |
| 109 | return cloneSessionEntry; |
| 110 | } |
| 111 | |
| 112 | PreReplicaCodec preReplica() { |
| 113 | return preReplica; |
| 114 | } |
| 115 | |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 116 | DirectMeterEntryCodec directMeterEntry() { |
| 117 | return directMeterEntry; |
| 118 | } |
| 119 | |
| 120 | MeterEntryCodec meterEntry() { |
| 121 | return meterEntry; |
| 122 | } |
| 123 | |
| 124 | CounterEntryCodec counterEntry() { |
| 125 | return counterEntry; |
| 126 | } |
| 127 | |
| 128 | DirectCounterEntryCodec directCounterEntry() { |
| 129 | return directCounterEntry; |
| 130 | } |
| 131 | } |