2 * @brief fake wifi agent - creates a station manually and send data to frm
8 #include "wifi_agent_idl.h"
9 #include "wifi_agent.h"
13 if( (a >= '0') && (a <= '9') )
15 else if ( (a >= 'A') && (a <= 'F') )
17 else if ( (a >= 'a') && (a <= 'f') )
22 long long mac_addr_string_to_number(char * mac)
40 mac_num[10] = mac[15];
41 mac_num[11] = mac[16];
45 for(ix = 0; ix <= 12 ; ix++)
48 for(ix2 = 1; ix2 < 12 - ix; ix2++)
50 number += atoint(mac_num[ix]) * help;
54 printf("%llu \n", number);
58 int main(int argc, char **argv)
62 CORBA_Environment env;
66 bool opt_daemon = false;
67 char *opt_pidfile = NULL;
71 while ((opt = getopt (argc, argv, "d:a:r:")) != -1) {
79 strcpy(mac_addr, optarg);
85 printf("Usage: %s -a mac_addr -r rate (Mbit/s)\n",
91 forb_daemon_prepare(opt_pidfile);
93 fwp_orb = forb_init(&argc, &argv, NULL); /* FORB initialization */
98 /* Find our implementation */
99 wai = forb_resolve_reference(fwp_orb, "net.sourceforge.frsh-forb.wai");
101 fprintf(stderr, "failed to create connection\n");
103 { printf("%d \n", rate);
104 wifi_agent_idl_add(wai, rate, mac_addr_string_to_number(mac_addr), &env);
106 //TODO: Print state is just for testing purposes - delete
107 wifi_agent_idl_print_state(wai, &env);