![]() |
ndn-lite
|
#include "service-discovery.h"
Functions | |
static void | _neighbors_init (void) |
static ndn_sd_identity_t * | _neighbors_find_neighbor (const name_component_t *identity) |
static ndn_sd_identity_t * | _neighbors_add_neighbor (const name_component_t *identity) |
static int | _neighbor_add_update_service (ndn_sd_identity_t *neighbor, const uint8_t *id_value, uint32_t id_size, const uint8_t status) |
static ndn_sd_identity_t * | _neighbors_find_first_service_provider (const uint8_t *id_value, uint32_t id_size) |
static void | _neighbor_reset_service (ndn_sd_identity_t *neighbor) |
static void | _neighbors_remove_neighbor (const name_component_t *id) |
void | ndn_sd_init (const ndn_name_t *home_prefix, const name_component_t *self_id) |
Init a Service Discovery State structure. More... | |
ndn_service_t * | ndn_sd_register_get_self_service (const char *prefix, uint32_t size) |
Get a pointer to a NDN service by searching its NDN service ID. More... | |
ndn_sd_identity_t * | ndn_sd_find_neigbor (const name_component_t *id) |
Find a neighbor in the neighbor list by searching its identity. More... | |
ndn_sd_identity_t * | ndn_sd_find_first_service_provider (const char *id_value, uint32_t id_size) |
Find a service provider in the neighbor list by searching service ID. More... | |
void | ndn_sd_prepare_advertisement (ndn_interest_t *interest) |
Prepare a Service Discovery Advertisement. More... | |
void | ndn_sd_prepare_query (ndn_interest_t *interest, name_component_t *target, ndn_service_t *service, const uint8_t *params_value, uint32_t params_size) |
Prepare a Service Discovery Query. More... | |
int | ndn_sd_on_advertisement_process (const ndn_interest_t *interest) |
Process Service Discovery Advertisement. More... | |
int | ndn_sd_on_query_process (const ndn_interest_t *interest, ndn_data_t *response) |
Process Service Discovery Query. More... | |
int | ndn_sd_on_query_response_process (const ndn_data_t *response) |
Process Service Discovery Query's Response. More... | |
int | ndn_sd_on_query_timeout_process (const ndn_interest_t *interest) |
Process Service Discovery Query's Timeout. More... | |
Variables | |
static ndn_sd_context_t | sd_context |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
ndn_sd_identity_t* ndn_sd_find_first_service_provider | ( | const char * | id_value, |
uint32_t | id_size | ||
) |
Find a service provider in the neighbor list by searching service ID.
id. | Input. The service ID searched. |
id_size. | Input. Size of input service ID. |
ndn_sd_identity_t* ndn_sd_find_neigbor | ( | const name_component_t * | id | ) |
Find a neighbor in the neighbor list by searching its identity.
id. | Input. The neighbor identity searched. |
void ndn_sd_init | ( | const ndn_name_t * | home_prefix, |
const name_component_t * | self_id | ||
) |
Init a Service Discovery State structure.
home_prefix. | Input. The network home prefix to configure the state manager. |
self_id. | Input. The local state manager identity. |
int ndn_sd_on_advertisement_process | ( | const ndn_interest_t * | interest | ) |
Process Service Discovery Advertisement.
This function will automatically set and update local Service Discovery State and is used in receiver side onInterest callback.
interest. | Input. Decoded advertisement interest. |
int ndn_sd_on_query_process | ( | const ndn_interest_t * | interest, |
ndn_data_t * | response | ||
) |
Process Service Discovery Query.
This function is used in receiver side onInterest callback.
interest. | Input. Decoded and signature verified query interest. |
response. | Output. Prepared query response. |
int ndn_sd_on_query_response_process | ( | const ndn_data_t * | response | ) |
Process Service Discovery Query's Response.
This function will automatically set and update local Service Discovery State and is used in sender side onData callback.
response. | Input. Decoded and signature verified query response. |
int ndn_sd_on_query_timeout_process | ( | const ndn_interest_t * | interest | ) |
Process Service Discovery Query's Timeout.
This function will automatically remove query target identity from local neighbor list and is used in sender side onInterestTimeout callback.
interest. | Input. Expired interest. |
void ndn_sd_prepare_advertisement | ( | ndn_interest_t * | interest | ) |
Prepare a Service Discovery Advertisement.
This function should be called after setting local services status.
interest. | Output. The prepared advertisement interest. |
void ndn_sd_prepare_query | ( | ndn_interest_t * | interest, |
name_component_t * | target, | ||
ndn_service_t * | service, | ||
const uint8_t * | params_value, | ||
uint32_t | params_size | ||
) |
Prepare a Service Discovery Query.
Users should manually sign the output query interest to obtain a valid signed query interest.
interest. | Output. The prepared unsigned query interest. |
target. | Input. The query target identity. |
service. | Input. The query target service. |
params_value. | Input. The query parameter buffer (optional) |
params_size. | Input. Size of input buffer (optional) |
ndn_service_t* ndn_sd_register_get_self_service | ( | const char * | id_value, |
uint32_t | id_size | ||
) |
Get a pointer to a NDN service by searching its NDN service ID.
id_value. | Input. Service ID buffer. |
id_size. | Input. Size of input service ID. |
|
static |