-shared_LIBRARIES += wifi_agent_functions
-wifi_agent_functions_SOURCES = wifi_agent.c
-wifi_agent_functions_SERVER_IDL = wifi_agent_idl.idl
+shared_LIBRARIES += wifi_agent_client_functions
+wifi_agent_client_functions_CLIENT_IDL = wifi_agent_idl.idl
include_HEADERS = wifi_agent.h
include_GEN_HEADERS = wifi_agent_idl.h
include_HEADERS = fwp_admctrl.h
bin_PROGRAMS = frm_fwp
-frm_fwp_SOURCES = fwp_mngr.c
-frm_fwp_LIBS = frm forb contract fosa rt ulut wifi_agent_functions fwp_admctrl
-
+frm_fwp_SOURCES = fwp_mngr.c wifi_agent.c
include_HEADERS = wifi_agent.h
+frm_fwp_SERVER_IDL = wifi_agent_idl.idl
+include_GEN_HEADERS = wifi_agent_idl.h
+frm_fwp_LIBS = frm forb contract fosa rt ulut fwp_admctrl fcb_client
+
CFLAGS += -D_FWP_INTERNALS_
lib_LOADLIBES+= frsh forb fosa pthread rt ulut
#include "wifi_agent.h"
#include "wvtest.h"
-typedef struct fwp_sta {
- long long client_mac_addr;
- int rate; //mbps
- bool erp_ofdm;
- bool short_preamble;
- bool bypass;
- ul_list_node_t sta_node;
-} fwp_sta_t;
-
-typedef struct fwp_sta_list {
- ul_list_head_t requests;
-} fwp_sta_list_t;
-
-struct frm_fwp_priv {
- int rate_mbps;
- bool erp_ofdm;
- bool short_preamble;
- bool bypass;
- fwp_sta_list_t sta_list;
-};
-
-UL_LIST_CUST_DEC(sta_list, // cust_prefix
- fwp_sta_list_t, // cust_head_t
- fwp_sta_t, // cust_item_t
- requests, // cust_head_field
- sta_node); // cust_node_field
-
-struct forb_wifi_agent_idl_impl wifi_agent_impl;
-
-struct frm_fwp_priv priv = {
- .rate_mbps = 1,
- .erp_ofdm = false,
- .short_preamble = false,
-// .list_head = NULL,//head of linked list initialized in main function
-};
-
//WVTEST_MAIN("list-of-stations-test")
int main(void)
{
- forb_orb orb;
- int ret;
- bool opt_daemon = false;
- char *opt_pidfile = NULL;
-
- forb_executor_t executor;
-
- wifi_agent_idl wai; //wifi agent interface
- struct fwp_sta intern_data;
- CORBA_Environment env;
-
- if (getenv("FWP_BYPASS"))
- priv.bypass = true;
-
- if (opt_daemon)
- forb_daemon_prepare(opt_pidfile);
-
- orb = forb_init(NULL, NULL, NULL);
- if (!orb) return 1;
+ forb_orb fwp_orb;
+ wifi_agent_idl wai;
+ CORBA_Environment env;
- wai = forb_wifi_agent_idl_new(orb, &wifi_agent_impl, &intern_data);
-
- forb_register_reference(wai, "net.sourceforge.frsh-forb.wai");
-
- sta_list_init_head(&priv.sta_list);
-
- ret = forb_executor_init(&executor);
- if (ret) return 1;
-
- ret = forb_executor_register_object(&executor, wai);
- if (ret) return 1;
-
- wifi_agent_idl_add(wai, 10, 120976291, &env);
- wifi_agent_idl_add(wai, 12, 120976291, &env);
- wifi_agent_idl_add(wai, 20, 80976291, &env);
- //wifi_agent_idl_add(wai, 64, 80955472, &env);
- //wifi_agent_idl_add(wai, 1, 80976291, &env);
- //wifi_agent_idl_add(wai, 10, 120976291, &env);
+ fwp_orb = forb_init(NULL, NULL, NULL); /* FORB initialization */
+
+ /* Find our implementation */
+ wai = forb_resolve_reference(fwp_orb, "net.sourceforge.frsh-forb.wai");
+ if(wai == NULL)
+ fprintf(stderr, "failed to create connection\n");
+ if(wai != NULL)
+ {
+ wifi_agent_idl_add(wai, 10, 120976291, &env); //new station
+ wifi_agent_idl_print_state(wai, &env);
+ wifi_agent_idl_add(wai, 12, 120976291, &env); //changed rate
+ wifi_agent_idl_add(wai, 21, 80976291, &env); //new station
+ wifi_agent_idl_print_state(wai, &env);
+ wifi_agent_idl_add(wai, 64, 80976291, &env); //changed rate
+ wifi_agent_idl_add(wai, 64, 80945292, &env); //new station
+ wifi_agent_idl_print_state(wai, &env);
+ }
return 0;
}
-
#include <frm_generic.h>
#include <forb.h>
#include <error.h>
#include "fwp_admctrl.h"
struct forb_wifi_agent_idl_impl wifi_agent_impl = {
- .add = wifi_agent_idl_add,
+ .add = wifi_agent_idl_add,
+ .print_state = wifi_agent_idl_print_state,
};
-void print_list_of_stations(void)
+/**
+ * Print list of stored stations
+ */
+void wifi_agent_idl_print_state(wifi_agent_idl _obj, CORBA_Environment *ev)
{
fwp_sta_t *sta2;
+ printf("Actual list of stations\n");
ul_list_for_each(sta_list, &priv.sta_list, sta2){
printf("%llu -", sta2->client_mac_addr);
printf(" %d\n", sta2->rate);
}
printf("------------\n\n");
-
}
/**
if(sta->client_mac_addr == ed->client_mac_addr) {
//mac address is the same change only rate
sta->rate = ed->rate;
-
- printf("Changed rate in a station %d\n", sta->client_mac_addr);
- printf("Actual list of all stations\n[mac address (dec) - rate]\n");
- print_list_of_stations();
return 0;
}
sta_list_ins_tail(&priv.sta_list, new_to_add);
- printf("Added new station\n");
- printf("Actual list of all stations\n[mac address (dec) - rate]\n");
- print_list_of_stations();
-
return 0;
}