blob: 421204443903a8156f8d1f4ab0f337a760d014ac [file] [log] [blame]
slowrd72fdf72017-09-01 12:49:21 -07001/*
2 * Copyright 2015-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
17package org.onosproject.xran.identifiers;
18
19import org.onosproject.xran.codecs.pdu.HOComplete;
20import org.onosproject.xran.codecs.pdu.UEAdmissionStatus;
21import org.onosproject.xran.codecs.pdu.UEContextUpdate;
22
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
94 public void reset() {
slowr23a93e12017-09-01 13:26:18 -070095 synchronized (this) {
96 this.hoComplete = null;
97 this.admissionStatus = null;
98 this.contextUpdate = null;
99 }
slowrd72fdf72017-09-01 12:49:21 -0700100 }
101
102 @Override
103 public String toString() {
104 return "ContextUpdateHandler{" +
105 "contextUpdate=" + (contextUpdate != null) +
106 ", admissionStatus=" + (admissionStatus != null) +
107 ", hoComplete=" + (hoComplete != null) +
108 '}';
109 }
110}