Commit 4311598c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

update header files

parent 2575d720
......@@ -645,8 +645,8 @@ void nrf_app::handle_nf_status_profile_changed(const std::string &profile_id) {
//------------------------------------------------------------------------------
void nrf_app::get_subscription_list(const std::string &profile_id,
uint8_t notification_type,
std::vector<std::string> &uris) {
const uint8_t &notification_type,
std::vector<std::string> &uris) const {
Logger::nrf_app().debug(
"Get the list of subscriptions related to this profile, profile id %s",
profile_id.c_str());
......
......@@ -205,27 +205,109 @@ class nrf_app {
*/
bool remove_nf_profile(const std::string &profile_id);
/*
* Add a subscription
* @param [const std::string &] sub_id: Subscription ID
* @param [std::shared_ptr<nrf_subscription> &] s: shared_pointer to the subscription to be added
* @return true if successful, otherwise, return false
*/
bool add_subscription(const std::string &sub_id,
const std::shared_ptr<nrf_subscription> &s);
/*
* Subscribe to the task tick event
* @param [uint64_t &] ms: Current time in ms
* @return void
*/
void subscribe_task_tick(uint64_t ms);
/*
* Handle when hearbeart timer expires
* @param [uint64_t] ms: current time in milliseconds
* @return void
*/
void handle_heartbeart_timeout(uint64_t ms);
/*
* Verify whether a subscription is authorized
* @param [std::shared_ptr<nrf_subscription> &] s: shared_pointer to the subscription
* @return true if this sub is authorized, otherwise, return false
*/
bool authorize_subscription(const std::shared_ptr<nrf_subscription> &s) const;
/*
* Generate an unique ID for the new subscription
* @param [const std::string &] sub_id: the generated ID
* @return void
*/
void generate_ev_subscription_id(std::string &sub_id);
/*
* Generate an unique ID for the new subscription
* @param void
* @return the generated ID
*/
evsub_id_t generate_ev_subscription_id();
/*
* Subscribe to the nf status events
* @param void
* @return void
*/
void subscribe_nf_status();
/*
* Subscribe to the event when a new NF registers to the NRF
* @param void
* @return void
*/
void subscribe_nf_status_registered();
/*
* Handle NF status registered event
* @param [const std::string &] profile_id: Profile ID of the registered NF
* @return void
*/
void handle_nf_status_registered(const std::string &profile_id);
/*
* Subscribe to the event when a NF de-registers from the NRF
* @param void
* @return void
*/
void subscribe_nf_status_deregistered();
/*
* Handle NF status deregistered event
* @param [const std::string &] profile_id: Profile ID of the deregistered NF
* @return void
*/
void handle_nf_status_deregistered(const std::string &profile_id);
/*
* Subscribe to the event when a registered NF changes its profile
* @param void
* @return void
*/
void subscribe_nf_status_profile_changed();
/*
* Handle NF status profile changed event
* @param [const std::string &] profile_id: Profile ID of the NF
* @return void
*/
void handle_nf_status_profile_changed(const std::string &profile_id);
/*
* Get the list of subscriptions to the profile with notification type
* @param [const std::string &] profile_id: Profile ID of the NF
* @param [const uint8_t &] notification_type: requested notification type
* @param [std::vector<std::string> &] uris: vector stores list of uri of subscribed NFs
* @return void
*/
void get_subscription_list(const std::string &profile_id,
uint8_t notification_type,
std::vector<std::string> &uris);
const uint8_t &notification_type,
std::vector<std::string> &uris) const;
private:
std::map<std::string, std::shared_ptr<nrf_profile>> instance_id2nrf_profile;
......
......@@ -60,19 +60,43 @@ class nrf_event {
friend class task_manager;
friend class nrf_profile;
/*
* Subscribe to the task tick event
* @param [const task_sig_t::slot_type &] sig
* @param [uint64_t] period: interval between two events
* @param [uint64_t] start:
* @return void
*/
bs2::connection subscribe_task_tick(const task_sig_t::slot_type &sig,
uint64_t period, uint64_t start = 0);
/*
* Subscribe to the extended task tick event
* @param [const task_sig_t::slot_type &] sig
* @param [uint64_t] period: interval between two events
* @param [uint64_t] start:
* @return void
*/
bs2::connection subscribe_task_tick_extended(
const task_sig_t::extended_slot_type &sig, uint64_t period,
uint64_t start = 0);
/*
* Subscribe to the nf status change event
* @param [const task_sig_t::slot_type &] sig
* @param [uint64_t] period: interval between two events
* @param [uint64_t] start:
* @return void
*/
bs2::connection subscribe_nf_status_change(
const nf_status_change_sig_t::slot_type &sig);
bs2::connection subscribe_nf_status_registered(
const nf_status_sig_t::slot_type &sig);
bs2::connection subscribe_nf_status_deregistered(
const nf_status_sig_t::slot_type &sig);
bs2::connection subscribe_nf_status_profile_changed(
const nf_status_sig_t::slot_type &sig);
......
......@@ -114,8 +114,6 @@ void nrf_subscription::display() {
}
Logger::nrf_app().debug(".............Notification Events: %s",
notif_events_str.c_str());
}
//------------------------------------------------------------------------------
......
......@@ -42,9 +42,7 @@ using namespace std;
class nrf_subscription {
public:
nrf_subscription(nrf_event &ev)
: m_event_sub(ev){
};
nrf_subscription(nrf_event &ev) : m_event_sub(ev){};
nrf_subscription(nrf_subscription const &) = delete;
......@@ -55,24 +53,108 @@ class nrf_subscription {
void operator=(nrf_subscription const &) = delete;
/*
* Set the subscription id
* @param [const std::string &]: sub_id: Subscription id
* @return void
*/
void set_subscription_id(const std::string &sub_id);
/*
* Get the subscription id
* @param [std::string &]: sub_id: Subscription id
* @return void
*/
void get_subscription_id(std::string &sub_id) const;
/*
* Get the subscription id
* @param [void]
* @return subscription id
*/
std::string get_subscription_id() const;
/*
* Set the notification URI (URI where the notification will be sent to)
* @param [const std::string &]: notification_uri: Notification URI
* @return void
*/
void set_notification_uri(const std::string &notification_uri);
/*
* Get the notification URI (URI where the notification will be sent to)
* @param [std::string &]: notification_uri: Notification URI
* @return void
*/
void get_notification_uri(std::string &notification_uri) const;
void display();
/*
* Set the subscription condition
* @param [const subscription_condition_t &]: c: Subscription condition
* @return void
*/
void set_sub_condition(const subscription_condition_t &c);
/*
* Get the subscription condition
* @param [const subscription_condition_t &]: c: Subscription condition
* @return void
*/
void get_sub_condition(subscription_condition_t &c) const;
// subscription_condition_t get_sub_condition() const;
/*
* Set the notification events
* @param [const std::vector<uint8_t> &]: ev_types: Array of the notification
* event types
* @return void
*/
void set_notif_events(const std::vector<uint8_t> &ev_types);
/*
* Add a notification type to the list of notification events
* @param [const uint8_t &]: ev_type: A notification type
* @return void
*/
void add_notif_event(const uint8_t &ev_type);
/*
* Get the notification events
* @param [std::vector<uint8_t> &]: ev_types: Array of the notification event
* types
* @return void
*/
void get_notif_events(std::vector<uint8_t> &ev_types) const;
/*
* Get the notification events
* @param [void]
* @return Array of the notification event types
*/
std::vector<uint8_t> get_notif_events() const;
/*
* Subscribe to be notified when a new NF registered to the NRF
* @param void
* @return void
*/
void subscribe_nf_status_registered();
/*
* Handle the NF Status Registered event
* @param [const std::shared_ptr<nrf_profile> &]: profile: pointer to the new
* registered NF profile
* @return void
*/
void handle_nf_status_registered(const std::shared_ptr<nrf_profile> &profile);
/*
* Display all the members of a subscription
* @param [void]
* @return void
*/
void display();
private:
std::string nf_status_notification_uri;
std::string subscription_id;
......
......@@ -46,11 +46,29 @@ namespace oai {
public:
task_manager(nrf_event& ev);
/*
* Manage the tasks
* @param [void]
* @return void
*/
void manage_tasks();
/*
* Run the tasks (for the moment, simply call function manage_tasks)
* @param [void]
* @return void
*/
void run();
private:
/*
* Make sure that the task tick run every 1ms
* @param [void]
* @return void
*/
void wait_for_cycle();
nrf_event& event_sub_;
int sfd;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment