/* Copyright 2009 Virginia Polytechnic Institute and State University Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* This header exports the declaration for the VTCROSS Shell component, which is * a critical part of every VTCROSS system. */ #ifndef CROSS_SHELL_H #define CROSS_SHELL_H #include "components.h" /* Cognitive Radio Shell class declaration. */ class CognitiveRadioShell { public: CognitiveRadioShell(); ~CognitiveRadioShell(); /* Overloaded constructor that creates a CR Shell object and loads the * passed radio configuration XML file. */ CognitiveRadioShell(const char* radioConfig, int16_t primaryPort, \ int16_t policyPort, int16_t commandPort); /* Ask for the component type of a remote component via sockets, or * respond to such a query sent to the shell itself. */ std::string GetRemoteComponentType(int32_t socketFD); void SendComponentType(int32_t socketFD); void Shutdown(); void Reset(); /* Start all the socket servers */ void StartShellServer(); int32_t LoadRadioConfiguration(const char* radioConfig, Parameter* &pList, \ Utility* &uList, Observable* &oList, Radio_Info* radioInfo); private: /* Parse and load/reload policies into the policy engine. */ void LoadPolicies(); void ReloadPolicies(); /* Register and Deregister the different components. */ void RegisterCognitiveEngine(int32_t socketFD); void DeregisterCognitiveEngine(int32_t socketFD); void RegisterPolicyEngine(int32_t socketFD); void DeregisterPolicyEngine(int32_t socketFD); void RegisterSML(int32_t socketFD); void DeregisterSML(int32_t socketFD); void SetActiveMission(int32_t socketFD); /* Handle a message that is received from a component. */ int32_t HandleMessage(int32_t socketFD); /* Send optimization request to primary port FD. */ void GetOptimalParameters(int32_t socketFD); /* TODO */ bool SendRadioConfiguration(int32_t socketFD); bool SendRadioExperience(int32_t socketFD); /* TODO */ bool UpdateParameterPerformance(int32_t socketFD); /* TODO */ bool SML_present; bool PE_present; bool CE_present; /* TODO */ int32_t numberOfCognitiveEngines; /* TODO */ int16_t primaryPort; int16_t policyPort; int16_t commandPort; /* TODO */ int32_t ceSocketFD; int32_t commandSocketFD; int32_t policySocketFD; /* TODO */ Utility *utils; Parameter *params; Observable *observables; /* TODO */ struct Radio_Info *radio_info; }; #endif