Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medium and mobility behaviour insertion for Wmediumd #4

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

amarti2038
Copy link

Hi,

As discussed with Javier Cardona and Javier Lopez this pull request has:

  • Code committed following the development process and with comments.
  • Global vars reduced to one struct.
  • Folder /wmediumd/tests/test-002-probabilities-with-mobility has scripts and diagrams for testing the code.

Attached diagram shows the app flow using the mobility behavior.

Sorry if there are mistakes :(

Best regards.

uml_activity_diagram_extension

Alberto Martínez I. added 10 commits December 4, 2013 19:37
- Launch scripts to automate mobility extension test scenario.
- Mobility option creation on main funtion.
- Config file structure creation and example.
- Application data structures to store the config file mobility config
data.
- Funtions to load mobility config data and print it on screen.
- Function creation (calculate_max_distance) to calculate maximum radio
link distance (dmax) using a link budget with free-space path loss
equation and config file data.
- Code placement ready to apply probabilities depending distance.
- Load basic config function (load_basic_config) it's a modified version
of load_config used to load application necessary data.
- Functions that find the radio positions and calculate the loss
probability.
- Initiate app globals as the timestamp used to see where stations are
located during time.
- Globals where introduced in one struct called mobility_medium_cfg to
decrease global variables.
- Radios array has now size depending number of radios defined in config
file, same with positions a radio has during time.
- Module coming with kernel versions > 3.X already suport wmediumd.
@koalo
Copy link

koalo commented Dec 17, 2013

Looks great, but I have some compiler warnings/errors with gcc 4.8.1 (but not with the original branch). Am I missing anything?

cc -DCONFIG_LIBNL30 -I/usr/include/libnl3   -DVERSION_STR="\"0.1\"" -g   -c -o wmediumd.o wmediumd.c
cc -DCONFIG_LIBNL30 -I/usr/include/libnl3   -DVERSION_STR="\"0.1\"" -g   -c -o probability.o probability.c
probability.c: In function ‘find_prob_by_addrs_mobility_and_medium’:
probability.c:223:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
     execution_time, mob_med_cfg.last_def_position, mob_med_cfg.dcurrent);
     ^
probability.c:229:5: warning: unknown conversion type character ‘)’ in format [-Wformat=]
     (int) mob_med_cfg.dmax);
     ^
probability.c:229:5: warning: unknown conversion type character ‘)’ in format [-Wformat=]
cc -DCONFIG_LIBNL30 -I/usr/include/libnl3   -DVERSION_STR="\"0.1\"" -g   -c -o mac_address.o mac_address.c
cc -DCONFIG_LIBNL30 -I/usr/include/libnl3   -DVERSION_STR="\"0.1\"" -g   -c -o config.o config.c
config.c: In function ‘load_mobility_medium_config’:
config.c:312:2: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
  if (config_lookup_int(cf, "debug", (long int *) &mob_med_cfg.debug) != CONFIG_TRUE) {
  ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:317:4: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
    (long int *) &mob_med_cfg.interference_tunner) != CONFIG_TRUE) {
    ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:323:4: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
    (long int *) &mob_med_cfg.fading_probability) != CONFIG_TRUE) {
    ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:329:4: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
    (long int *) &mob_med_cfg.fading_intensity) != CONFIG_TRUE) {
    ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:380:4: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
    (long int *) &count_radios);
    ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:396:5: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
     (long int *) &mob_med_cfg.radios[i].count_positions);
     ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c:421:9: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
    temp = config_setting_get_string_elem(mat_array, j);
         ^
config.c: In function ‘load_basic_config’:
config.c:489:4: warning: passing argument 3 of ‘config_lookup_int’ from incompatible pointer type [enabled by default]
    (long int *) &count_value);
    ^
In file included from config.c:24:0:
/usr/include/libconfig.h:266:26: note: expected ‘int *’ but argument is of type ‘long int *’
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                          ^
config.c: At top level:
config.c:518:6: warning: conflicting types for ‘calcule_max_distance’ [enabled by default]
 void calcule_max_distance(double carr_freq, double trans_pow, double trans_gain,
      ^
config.c:374:2: note: previous implicit declaration of ‘calcule_max_distance’ was here
  calcule_max_distance(carrier_frequency, transmit_power, transmit_gain,
  ^
config.c: In function ‘calcule_max_distance’:
config.c:527:15: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
  second = abs(pow(first,1.0/2.0));
               ^
config.c: At top level:
config.c:536:6: warning: conflicting types for ‘print_mobility_medium_configuration’ [enabled by default]
 void print_mobility_medium_configuration() {
      ^
config.c:435:2: note: previous implicit declaration of ‘print_mobility_medium_configuration’ was here
  print_mobility_medium_configuration();
  ^
config.c: In function ‘print_mobility_medium_configuration’:
config.c:546:4: warning: unknown conversion type character ‘)’ in format [-Wformat=]
    (mob_med_cfg.interference_tunner * 100 / 1000));
    ^
config.c:549:4: warning: unknown conversion type character ‘)’ in format [-Wformat=]
    (mob_med_cfg.fading_probability * 100 / 1000));
    ^
config.c:553:4: warning: unknown conversion type character ‘)’ in format [-Wformat=]
    (mob_med_cfg.fading_intensity * 100 / 1000));
    ^
config.c:555:2: warning: too many arguments for format [-Wformat-extra-args]
  printf("MAC ADRESSES", i);
  ^
cc -o wmediumd wmediumd.o probability.o mac_address.o config.o -lnl-genl-3 -lnl-3   -lconfig  
/usr/bin/ld: probability.o: undefined reference to symbol 'pow@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [wmediumd] Error 1

@amarti2038
Copy link
Author

A missed linker flag and solved most of warnings.

@koalo
Copy link

koalo commented Jan 2, 2014

Thank you! It compiles now. The remaining warnings can be fixed by escaping the percent character. I.e. % -> %%
I will test your patches soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants