slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 1 | /* |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 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 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 17 | package org.onosproject.xran.impl.identifiers; |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 18 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 19 | import org.onosproject.xran.asn1lib.pdu.HOComplete; |
| 20 | import org.onosproject.xran.asn1lib.pdu.UEAdmissionStatus; |
| 21 | import org.onosproject.xran.asn1lib.pdu.UEContextUpdate; |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Class to handle UE Context Update packet. |
| 25 | */ |
| 26 | public class ContextUpdateHandler { |
| 27 | private UEContextUpdate contextUpdate; |
| 28 | private UEAdmissionStatus admissionStatus; |
| 29 | private HOComplete hoComplete; |
| 30 | |
| 31 | /** |
| 32 | * Get Context Update. |
| 33 | * @return UEContextUpdate |
| 34 | */ |
| 35 | public UEContextUpdate getContextUpdate() { |
| 36 | return contextUpdate; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Set Context Update. |
| 41 | * @param contextUpdate UEContextUpdate |
| 42 | * @return boolean to check context update was for admissionStatus packet or HOComplete packet |
| 43 | */ |
| 44 | public boolean setContextUpdate(UEContextUpdate contextUpdate) { |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 45 | synchronized (this) { |
| 46 | this.contextUpdate = contextUpdate; |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 47 | |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 48 | return admissionStatus != null || hoComplete != null; |
| 49 | } |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Get UEAdmissionStatus. |
| 54 | * @return UEAdmissionStatus |
| 55 | */ |
| 56 | public UEAdmissionStatus getAdmissionStatus() { |
| 57 | return admissionStatus; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Set UEAdmissionStatus. |
| 62 | * @param admissionStatus UEAdmissionStatus |
| 63 | * @return boolean contextUpdate exists or not |
| 64 | */ |
| 65 | public boolean setAdmissionStatus(UEAdmissionStatus admissionStatus) { |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 66 | synchronized (this) { |
| 67 | this.admissionStatus = admissionStatus; |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 68 | |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 69 | return contextUpdate != null; |
| 70 | } |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Get HOComplete. |
| 75 | * @return HOComplete |
| 76 | */ |
| 77 | public HOComplete getHoComplete() { |
| 78 | return hoComplete; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Set HOComplete. |
| 83 | * @param hoComplete HOComplete |
| 84 | * @return boolean contextUpdate exists or not |
| 85 | */ |
| 86 | public boolean setHoComplete(HOComplete hoComplete) { |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 87 | synchronized (this) { |
| 88 | this.hoComplete = hoComplete; |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 89 | |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 90 | return contextUpdate != null; |
| 91 | } |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Dimitrios Mavrommatis | 96b255a | 2017-12-06 13:09:25 -0800 | [diff] [blame] | 94 | /** |
| 95 | * Reset the values of the variables. |
| 96 | * |
| 97 | */ |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 98 | public void reset() { |
slowr | 23a93e1 | 2017-09-01 13:26:18 -0700 | [diff] [blame] | 99 | synchronized (this) { |
| 100 | this.hoComplete = null; |
| 101 | this.admissionStatus = null; |
| 102 | this.contextUpdate = null; |
| 103 | } |
slowr | d72fdf7 | 2017-09-01 12:49:21 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public String toString() { |
| 108 | return "ContextUpdateHandler{" + |
| 109 | "contextUpdate=" + (contextUpdate != null) + |
| 110 | ", admissionStatus=" + (admissionStatus != null) + |
| 111 | ", hoComplete=" + (hoComplete != null) + |
| 112 | '}'; |
| 113 | } |
| 114 | } |