Академический Документы
Профессиональный Документы
Культура Документы
h>
#include <unistd.h>
#include
#include
#include
#include
<common/defs.h>
<common/init.h>
<common/util.h>
<common/net.h>
/*
* global vars, defined in each app
* Don't forget to declare them in each ".c" file
*/
uint64 proc_id = 0;
/* this process id */
link_info_t * nodes = NULL;
/* peer matrix */
bool_t exit_request = FALSE;
static char * fname = NULL;
/*
* Event handler functions.
* These functions must properly free the cookie revieved.
*/
int testfunc1(void * cookie)
{
uint8 *buff = NULL;
int len = 0;
/*
* Test by using this at terminal;
* $ netcat -u localhost 9001
*/
dbg_msg("A message arrived from the depths of internet! cookie='%s'", (char
*)cookie);
dbg_msg("Go check the socket! :p");
/* This is just a test now */
dme_recv_msg(&buff, &len);
dbg_msg("Oh goodie! recieved message[%d]: %s", len, buff);
return 0;
}
int main(int argc, char *argv[])
{
FILE *fh;
int res = 0;
if (0 != (res = parse_params(argc, argv, &proc_id, &fname))) {
dbg_err("parse_args() returned nonzero status:%d", res);
goto end;
}
/*
* Parse the file in fname
*/
if (0 != (res = parse_file(fname, proc_id, &nodes))) {
dbg_err("parse_file() returned nonzero status:%d", res);
goto end;
}