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