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; |
Daniele Moro | d900fe4 | 2021-02-11 16:12:57 +0100 | [diff] [blame^] | 43 | private final ActionSetCodec actionSet; |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 44 | |
| 45 | private Codecs() { |
| 46 | this.action = new ActionCodec(); |
| 47 | this.actionProfileGroup = new ActionProfileGroupCodec(); |
| 48 | this.actionProfileMember = new ActionProfileMemberCodec(); |
| 49 | this.counterEntry = new CounterEntryCodec(); |
| 50 | this.directCounterEntry = new DirectCounterEntryCodec(); |
| 51 | this.directMeterEntry = new DirectMeterEntryCodec(); |
| 52 | this.entity = new EntityCodec(); |
| 53 | this.fieldMatch = new FieldMatchCodec(); |
| 54 | this.handle = new HandleCodec(); |
| 55 | this.meterEntry = new MeterEntryCodec(); |
| 56 | this.multicastGroupEntry = new MulticastGroupEntryCodec(); |
Carmelo Cascone | 9db4d5c | 2019-04-16 17:36:33 -0700 | [diff] [blame] | 57 | this.cloneSessionEntry = new CloneSessionEntryCodec(); |
| 58 | this.preReplica = new PreReplicaCodec(); |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 59 | this.packetIn = new PacketInCodec(); |
| 60 | this.packetMetadata = new PacketMetadataCodec(); |
| 61 | this.packetOut = new PacketOutCodec(); |
| 62 | this.tableEntry = new TableEntryCodec(); |
Daniele Moro | d900fe4 | 2021-02-11 16:12:57 +0100 | [diff] [blame^] | 63 | this.actionSet = new ActionSetCodec(); |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | public EntityCodec entity() { |
| 67 | return entity; |
| 68 | } |
| 69 | |
| 70 | public HandleCodec handle() { |
| 71 | return handle; |
| 72 | } |
| 73 | |
| 74 | public PacketOutCodec packetOut() { |
| 75 | return packetOut; |
| 76 | } |
| 77 | |
| 78 | public PacketInCodec packetIn() { |
| 79 | return packetIn; |
| 80 | } |
| 81 | |
| 82 | TableEntryCodec tableEntry() { |
| 83 | return tableEntry; |
| 84 | } |
| 85 | |
| 86 | FieldMatchCodec fieldMatch() { |
| 87 | return fieldMatch; |
| 88 | } |
| 89 | |
| 90 | ActionCodec action() { |
| 91 | return action; |
| 92 | } |
| 93 | |
| 94 | ActionProfileMemberCodec actionProfileMember() { |
| 95 | return actionProfileMember; |
| 96 | } |
| 97 | |
| 98 | ActionProfileGroupCodec actionProfileGroup() { |
| 99 | return actionProfileGroup; |
| 100 | } |
| 101 | |
| 102 | PacketMetadataCodec packetMetadata() { |
| 103 | return packetMetadata; |
| 104 | } |
| 105 | |
| 106 | MulticastGroupEntryCodec multicastGroupEntry() { |
| 107 | return multicastGroupEntry; |
| 108 | } |
| 109 | |
Carmelo Cascone | 9db4d5c | 2019-04-16 17:36:33 -0700 | [diff] [blame] | 110 | CloneSessionEntryCodec cloneSessionEntry() { |
| 111 | return cloneSessionEntry; |
| 112 | } |
| 113 | |
| 114 | PreReplicaCodec preReplica() { |
| 115 | return preReplica; |
| 116 | } |
| 117 | |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 118 | DirectMeterEntryCodec directMeterEntry() { |
| 119 | return directMeterEntry; |
| 120 | } |
| 121 | |
| 122 | MeterEntryCodec meterEntry() { |
| 123 | return meterEntry; |
| 124 | } |
| 125 | |
| 126 | CounterEntryCodec counterEntry() { |
| 127 | return counterEntry; |
| 128 | } |
| 129 | |
| 130 | DirectCounterEntryCodec directCounterEntry() { |
| 131 | return directCounterEntry; |
| 132 | } |
Daniele Moro | d900fe4 | 2021-02-11 16:12:57 +0100 | [diff] [blame^] | 133 | |
| 134 | ActionSetCodec actionSet() { |
| 135 | return actionSet; |
| 136 | } |
Carmelo Cascone | 4c289b7 | 2019-01-22 15:30:45 -0800 | [diff] [blame] | 137 | } |