Permalink
Cannot retrieve contributors at this time
57 lines (39 sloc)
1.56 KB
======================================================================== | |
Coding style, some useful global MACROS and functions descriptions | |
======================================================================== | |
-------- | |
MACROS | |
-------- | |
USER_MSG | |
+ *every* output should be achieved thru the macro USER_MSG(x, ...) | |
in this way when the inteface will be coded, it is sufficient | |
to change this macro to redirect user messages to the right place. | |
DEBUG_MSG | |
+ to print a debug message use the macro DEBUG_MSG(x, ...) | |
to enable the debug you should use ./configure --enable-debug | |
ERROR_MSG | |
+ the macro ERROR_MSG(x, ...) print the file:function:line, errno, | |
strerror and a the user message x. | |
useful on unexpected behaviours. | |
ON_ERROR | |
+ the macro ON_ERROR(x, y, f, ...) expands to : | |
if (x == y) | |
ERROR_MSG(f, ...) | |
useful to check null pointer as follow: | |
foo = malloc(10); | |
ON_ERROR(foo, NULL, "cant allocate memory"); | |
FATAL_MSG | |
+ print the message and execute an exit(1) | |
------- | |
API | |
------- | |
+ THREADS | |
the file lmap_threads.c provides all the necessary functions to create and | |
destroy new thread. other files should be not aware of the pthread.h include | |
file. | |
the thread list is intended to have a list of active thread that the user can | |
kill or create thru the user interface. obviously some thread can't be killed | |
such as the capturer, the euristic and the user interface. all the active | |
probing thread are stored in the list and can be killed at any time. | |
/* EOF */ | |
vim:ts=3:expandtab |