2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
23 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
24 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
32 type Subscription struct {
33 mutex sync.Mutex // Lock
34 registry *Registry // Registry
36 Meid *xapp.RMRMeid // Meid/ RanName
37 EpList RmrEndpointList // Endpoints
38 TransLock sync.Mutex // Lock transactions, only one executed per time for subs
39 TheTrans *Transaction // Ongoing transaction from xapp
40 SubReqMsg *e2ap.E2APSubscriptionRequest // Subscription information
41 SubRespMsg *e2ap.E2APSubscriptionResponse // Subscription information
44 func (s *Subscription) String() string {
45 return "subs(" + strconv.FormatUint(uint64(s.Seq), 10) + "/" + s.Meid.RanName + "/" + s.EpList.String() + ")"
48 func (s *Subscription) GetSubId() uint16 {
50 defer s.mutex.Unlock()
54 func (s *Subscription) GetMeid() *xapp.RMRMeid {
56 defer s.mutex.Unlock()
63 func (s *Subscription) IsTransactionReserved() bool {
65 defer s.mutex.Unlock()
66 if s.TheTrans != nil {
73 func (s *Subscription) GetTransaction() *Transaction {
75 defer s.mutex.Unlock()
79 func (s *Subscription) WaitTransactionTurn(trans *Transaction) {
86 func (s *Subscription) ReleaseTransactionTurn(trans *Transaction) {
88 if trans != nil && trans == s.TheTrans {