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 Policy Engine component type. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef POLICY_ENGINE_H |
---|
21 | #define POLICY_ENGINE_H |
---|
22 | |
---|
23 | |
---|
24 | #include "components.h" |
---|
25 | |
---|
26 | |
---|
27 | /* Policy Engine class declaration. All public functions are inherited from |
---|
28 | * parent classes. |
---|
29 | */ |
---|
30 | class PolicyEngine : public Engine |
---|
31 | { |
---|
32 | public: |
---|
33 | PolicyEngine(); |
---|
34 | ~PolicyEngine(); |
---|
35 | |
---|
36 | /* Overloaded constructor that creates a policy engine object and |
---|
37 | * connects it to either the shell or an SML, depening on the SML bool. |
---|
38 | */ |
---|
39 | PolicyEngine(const char* serverName, const char* serverPort, \ |
---|
40 | const bool SML); |
---|
41 | |
---|
42 | void SendComponentType(); |
---|
43 | void ConnectToRemoteComponent(const char* serverName, \ |
---|
44 | const char* serverPort, const bool SML); |
---|
45 | void WaitForSignal(); |
---|
46 | void Shutdown(); |
---|
47 | void Reset(); |
---|
48 | void RegisterComponent(); |
---|
49 | void DeregisterComponent(); |
---|
50 | |
---|
51 | void RegisterServices(); |
---|
52 | void DeregisterServices(); |
---|
53 | |
---|
54 | private: |
---|
55 | /* Parse and load/reload policies into the policy engine. |
---|
56 | */ |
---|
57 | void LoadPolicies(); |
---|
58 | void ReloadPolicies(); |
---|
59 | |
---|
60 | /* Return a decision made by the policy engine regarding a certain set |
---|
61 | * of transmission parameters. |
---|
62 | */ |
---|
63 | void SendPEDecision(struct Parameter pList[], struct Radio_Info *radio_info, \ |
---|
64 | int32_t decision_array[]); |
---|
65 | |
---|
66 | /* Validate a set of transmission parameters received from the radio. |
---|
67 | */ |
---|
68 | void ValidateParameters(); |
---|
69 | |
---|
70 | /* The SML_present bool reflects whether or not the remote component |
---|
71 | * this object is connected to is an SML. If it isn't, then it must be |
---|
72 | * a shell. The socketFD stores the socket file descriptor for this |
---|
73 | * connection. |
---|
74 | */ |
---|
75 | bool SML_present; |
---|
76 | int32_t commandSocketFD; |
---|
77 | }; |
---|
78 | |
---|
79 | #endif |
---|