RINASim  October 2016
Documentation of framework for OMNeT++
APBase.h
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #ifndef APBASE_H_
24 #define APBASE_H_
25 
26 #include <omnetpp.h>
27 #include <string>
28 #include "Flow.h"
29 #include "APIResult.h"
30 #include "APIRetObj.h"
31 #include "CDAPMessage_m.h"
32 #include <map>
33 #include "ExternConsts.h"
34 #include "RINASignals.h"
35 
36 class APBase : public cSimpleModule {
37 public:
38  APBase();
39  virtual ~APBase();
40 
41  int getCurrentAEInstNum(std::string AEName);
42 
43  virtual void onA_getOpen(APIResult* result) = 0;
44  virtual void onA_getRead(APIResult* result) = 0;
45  virtual void onA_getWrite(APIResult* result) = 0;
46  virtual void onClose(APIResult* result) = 0;
47 
48 protected:
50 
51  virtual bool a_open(int invokeID, std::string APname, std::string APinst, std::string AEname, std::string AEinst) = 0;
52  virtual bool a_open(int invokeID, Flow* flow) = 0;
53  virtual bool a_close(int CDAPConn, int invokeID = 0) = 0;
54  virtual bool a_read(int CDAPConn, std::string objName, int invokeID = 0) = 0;
55  virtual bool a_write(int CDAPConn, std::string objName, object_t *obj, int invokeID = 0) = 0;
56 
57  virtual APIRetObj* a_getopen_r(int invokeID) = 0;
58  virtual APIRetObj* a_getclose_r(int CDAPConn, int invokeID = 0) = 0;
59  virtual bool a_read_r(int CDAPconn, int invokeID, std::string objName, object_t *obj, bool complete = true) = 0;
60  virtual APIRetObj* a_get_read_r(int CDAPConn, int invokeID) = 0;
61  virtual bool a_cancelread_r(int CDAPConn, int invokeID = 0) = 0;
62  virtual APIRetObj* a_getwrite_r(int CDAPconn, int invokeID, APIResult* result, std::string objName, object_t *obj = NULL) = 0;
63 
64  int getNewInvokeID();
65 
66  virtual void initialize();
67  virtual void handleMessage(cMessage *msg);
68 
69  int getNewAEInstNum(std::string AEName);
70 
71  unsigned long getNewCdapConID();
72 
74 private:
76  unsigned long currentCdapConId;
77  std::map<std::string, int> AEInstNumbers;
78 
79 };
80 
81 #endif /* APBASE_H_ */
Class representing flow object with attributes from specs.
Definition: Flow.h:45
virtual APIRetObj * a_getclose_r(int CDAPConn, int invokeID=0)=0
virtual void onA_getWrite(APIResult *result)=0
virtual void onA_getOpen(APIResult *result)=0
int currentInvokeId
Definition: APBase.h:75
virtual void onClose(APIResult *result)=0
Definition: APBase.h:36
int getCurrentAEInstNum(std::string AEName)
Definition: APBase.cc:51
virtual bool a_write(int CDAPConn, std::string objName, object_t *obj, int invokeID=0)=0
virtual bool a_cancelread_r(int CDAPConn, int invokeID=0)=0
EnrollmentState
Definition: APBase.h:49
unsigned long getNewCdapConID()
Definition: APBase.cc:55
virtual APIRetObj * a_getwrite_r(int CDAPconn, int invokeID, APIResult *result, std::string objName, object_t *obj=NULL)=0
virtual APIRetObj * a_get_read_r(int CDAPConn, int invokeID)=0
int getNewInvokeID()
Definition: APBase.cc:59
APBase()
Definition: APBase.cc:25
int getNewAEInstNum(std::string AEName)
Definition: APBase.cc:40
virtual bool a_read(int CDAPConn, std::string objName, int invokeID=0)=0
EnrollmentState isEnrolled
Definition: APBase.h:73
virtual APIRetObj * a_getopen_r(int invokeID)=0
virtual bool a_open(int invokeID, std::string APname, std::string APinst, std::string AEname, std::string AEinst)=0
virtual void onA_getRead(APIResult *result)=0
virtual bool a_read_r(int CDAPconn, int invokeID, std::string objName, object_t *obj, bool complete=true)=0
virtual void handleMessage(cMessage *msg)
Definition: APBase.cc:37
virtual bool a_close(int CDAPConn, int invokeID=0)=0
virtual void initialize()
Definition: APBase.cc:34
virtual ~APBase()
Definition: APBase.cc:30
std::map< std::string, int > AEInstNumbers
Definition: APBase.h:77
unsigned long currentCdapConId
Definition: APBase.h:76