1 | /* |
---|
2 | Copyright 2009 Virginia Polytechnic Institute and State University |
---|
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 | |
---|
17 | /* This header exports the declaration for the VTCROSS Shell component, which is |
---|
18 | * a critical part of every VTCROSS system. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef CROSS_SHELL_H |
---|
22 | #define CROSS_SHELL_H |
---|
23 | |
---|
24 | |
---|
25 | #include "components.h" |
---|
26 | |
---|
27 | |
---|
28 | /* Cognitive Radio Shell class declaration. |
---|
29 | */ |
---|
30 | class CognitiveRadioShell |
---|
31 | { |
---|
32 | public: |
---|
33 | CognitiveRadioShell(); |
---|
34 | ~CognitiveRadioShell(); |
---|
35 | |
---|
36 | /* Overloaded constructor that creates a CR Shell object and loads the |
---|
37 | * passed radio configuration XML file. |
---|
38 | */ |
---|
39 | CognitiveRadioShell(const char* radioConfig, int16_t primaryPort, \ |
---|
40 | int16_t policyPort, int16_t commandPort); |
---|
41 | |
---|
42 | /* Ask for the component type of a remote component via sockets, or |
---|
43 | * respond to such a query sent to the shell itself. |
---|
44 | */ |
---|
45 | std::string GetRemoteComponentType(int32_t socketFD); |
---|
46 | void SendComponentType(int32_t socketFD); |
---|
47 | |
---|
48 | void Shutdown(); |
---|
49 | void Reset(); |
---|
50 | |
---|
51 | /* Start all the socket servers */ |
---|
52 | void StartShellServer(); |
---|
53 | |
---|
54 | int32_t LoadRadioConfiguration(const char* radioConfig, Parameter* &pList, \ |
---|
55 | Utility* &uList, Observable* &oList, Radio_Info* radioInfo); |
---|
56 | private: |
---|
57 | /* Parse and load/reload policies into the policy engine. |
---|
58 | */ |
---|
59 | void LoadPolicies(); |
---|
60 | void ReloadPolicies(); |
---|
61 | |
---|
62 | /* Register and Deregister the different components. |
---|
63 | */ |
---|
64 | void RegisterCognitiveEngine(int32_t socketFD); |
---|
65 | void DeregisterCognitiveEngine(int32_t socketFD); |
---|
66 | void RegisterPolicyEngine(int32_t socketFD); |
---|
67 | void DeregisterPolicyEngine(int32_t socketFD); |
---|
68 | void RegisterSML(int32_t socketFD); |
---|
69 | void DeregisterSML(int32_t socketFD); |
---|
70 | |
---|
71 | void SetActiveMission(int32_t socketFD); |
---|
72 | |
---|
73 | /* Handle a message that is received from a component. |
---|
74 | */ |
---|
75 | int32_t HandleMessage(int32_t socketFD); |
---|
76 | |
---|
77 | /* Send optimization request to primary port FD. |
---|
78 | */ |
---|
79 | void GetOptimalParameters(int32_t socketFD); |
---|
80 | |
---|
81 | /* TODO |
---|
82 | */ |
---|
83 | bool SendRadioConfiguration(int32_t socketFD); |
---|
84 | bool SendRadioExperience(int32_t socketFD); |
---|
85 | |
---|
86 | /* TODO |
---|
87 | */ |
---|
88 | bool UpdateParameterPerformance(int32_t socketFD); |
---|
89 | |
---|
90 | /* TODO |
---|
91 | */ |
---|
92 | bool SML_present; |
---|
93 | bool PE_present; |
---|
94 | bool CE_present; |
---|
95 | |
---|
96 | /* TODO |
---|
97 | */ |
---|
98 | int32_t numberOfCognitiveEngines; |
---|
99 | |
---|
100 | /* TODO |
---|
101 | */ |
---|
102 | int16_t primaryPort; |
---|
103 | int16_t policyPort; |
---|
104 | int16_t commandPort; |
---|
105 | |
---|
106 | /* TODO |
---|
107 | */ |
---|
108 | int32_t ceSocketFD; |
---|
109 | int32_t commandSocketFD; |
---|
110 | int32_t policySocketFD; |
---|
111 | |
---|
112 | /* TODO |
---|
113 | */ |
---|
114 | Utility *utils; |
---|
115 | Parameter *params; |
---|
116 | Observable *observables; |
---|
117 | |
---|
118 | /* TODO |
---|
119 | */ |
---|
120 | struct Radio_Info *radio_info; |
---|
121 | }; |
---|
122 | |
---|
123 | #endif |
---|