blob: 22098253d7d7015b98728fb74b8b09e26210636a [file] [log] [blame]
slowrd72fdf72017-09-01 12:49:21 -07001/*
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08002 * Copyright 2017-present Open Networking Foundation
slowrd72fdf72017-09-01 12:49:21 -07003 *
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 Mavrommatis96b255a2017-12-06 13:09:25 -080017package org.onosproject.xran.impl.identifiers;
slowrd72fdf72017-09-01 12:49:21 -070018
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080019import org.onosproject.xran.asn1lib.pdu.HOComplete;
20import org.onosproject.xran.asn1lib.pdu.UEAdmissionStatus;
21import org.onosproject.xran.asn1lib.pdu.UEContextUpdate;
slowrd72fdf72017-09-01 12:49:21 -070022
23/**
24 * Class to handle UE Context Update packet.
25 */
26public 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) {
slowr23a93e12017-09-01 13:26:18 -070045 synchronized (this) {
46 this.contextUpdate = contextUpdate;
slowrd72fdf72017-09-01 12:49:21 -070047
slowr23a93e12017-09-01 13:26:18 -070048 return admissionStatus != null || hoComplete != null;
49 }
slowrd72fdf72017-09-01 12:49:21 -070050 }
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) {
slowr23a93e12017-09-01 13:26:18 -070066 synchronized (this) {
67 this.admissionStatus = admissionStatus;
slowrd72fdf72017-09-01 12:49:21 -070068
slowr23a93e12017-09-01 13:26:18 -070069 return contextUpdate != null;
70 }
slowrd72fdf72017-09-01 12:49:21 -070071 }
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) {
slowr23a93e12017-09-01 13:26:18 -070087 synchronized (this) {
88 this.hoComplete = hoComplete;
slowrd72fdf72017-09-01 12:49:21 -070089
slowr23a93e12017-09-01 13:26:18 -070090 return contextUpdate != null;
91 }
slowrd72fdf72017-09-01 12:49:21 -070092 }
93
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080094 /**
95 * Reset the values of the variables.
96 *
97 */
slowrd72fdf72017-09-01 12:49:21 -070098 public void reset() {
slowr23a93e12017-09-01 13:26:18 -070099 synchronized (this) {
100 this.hoComplete = null;
101 this.admissionStatus = null;
102 this.contextUpdate = null;
103 }
slowrd72fdf72017-09-01 12:49:21 -0700104 }
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}