#include "fwp_vres.h"
#include "fwp.h"
#include "fwp_res.h"
+#include "fwp_utils.h"
+#include "fwp_debug.h"
int fwp_fna_init(const frsh_resource_id_t resource_id)
{
fwp_SOURCES = fwp_utils.c fwp_vres.c fwp_msgb.c fwp_msgq.c fwp_endpoint.c fwp.c
include_HEADERS= fwp_conf.h fwp_confdefs.h fwp_endpoint.h fwp_vres.h fwp.h fwp_msgb.h\
fwp_msgq.h fwp_utils.h
+
+include_HEADERS += fwp_debug.h # This file (and maybe even some \
+ others) should not be exported!
+
lib_LOADLIBES+= pthread rt ulut
#include "fwp_conf.h"
#include "fwp_vres.h"
#include "fwp_utils.h"
+#include <ul_logreg.h>
+#include "fwp_debug.h"
+
+ul_log_domain_t ulogd_fwp = {UL_LOGL_MSG, "fwp"};
+UL_LOGREG_SINGLE_DOMAIN_INIT_FUNCTION(init_ulogd_fwo, ulogd_fwp);
int fwp_init()
{
--- /dev/null
+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* Copyright (C) 2006 - 2008 FRESCOR consortium partners: */
+/* */
+/* Universidad de Cantabria, SPAIN */
+/* University of York, UK */
+/* Scuola Superiore Sant'Anna, ITALY */
+/* Kaiserslautern University, GERMANY */
+/* Univ. Politécnica Valencia, SPAIN */
+/* Czech Technical University in Prague, CZECH REPUBLIC */
+/* ENEA SWEDEN */
+/* Thales Communication S.A. FRANCE */
+/* Visual Tools S.A. SPAIN */
+/* Rapita Systems Ltd UK */
+/* Evidence ITALY */
+/* */
+/* See http://www.frescor.org for a link to partners' websites */
+/* */
+/* FRESCOR project (FP6/2005/IST/5-034026) is funded */
+/* in part by the European Union Sixth Framework Programme */
+/* The European Union is not liable of any use that may be */
+/* made of this code. */
+/* */
+/* */
+/* This file is part of FWP (Frescor WLAN Protocol) */
+/* */
+/* FWP is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. FWP is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with FWP; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* As a special exception, including FWP header files in a file, */
+/* instantiating FWP generics or templates, or linking other files */
+/* with FWP objects to produce an executable application, does not */
+/* by itself cause the resulting executable application to be covered */
+/* by the GNU General Public License. This exception does not */
+/* however invalidate any other reasons why the executable file might be */
+/* covered by the GNU Public License. */
+/**************************************************************************/
+
+#ifndef FWP_DEBUG_H
+#define FWP_DEBUG_H
+
+#include <ul_log.h>
+
+extern UL_LOG_CUST(ulogd_fwp);
+
+#define FWP_DEBUG(fmt,args...) ul_logdeb("%s: " fmt, __func__ , ##args)
+#define FWP_ERROR(fmt,args...) ul_logerr("%s: " fmt, __func__ , ##args)
+
+
+#endif
#include "fwp_endpoint.h"
#include "fwp_msgb.h"
#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include "fwp_utils.h"
#include <pthread.h>
+#include "fwp_debug.h"
typedef unsigned int fwp_endpoint_id_t;
}
if (listen(fwp_epoint->sockd, fwp_epoint->attr.max_connections)){
- perror("Error on listen call\n");
+ FWP_ERROR("Error on listen call: %s\n", strerror(errno));
goto err;
}
&peer.addrlen);
if (csockd < 0) {
- perror("Error on accept\n");
+ FWP_ERROR("Error on accept: %s\n", strerror(errno));
return errno;
}
/* queueing policy*/
} fwp_endpoint_attr_t;
-/*TODO: extract FWP_DEBUG from fwp_utils.h */
-#include "fwp_utils.h"
#include "fwp_vres.h"
int fwp_endpoint_get_params(fwp_endpoint_d_t epointd, unsigned int *node,
/**************************************************************************/
#include "fwp_utils.h"
+#include <unistd.h>
#include <sched.h>
/*#include <stdlib.h>*/
+#include "fwp_debug.h"
+#include <errno.h>
/*const int prio_to_ac[8] = {2,3,3,2,1,1,0,0};
const unsigned int ac_to_tos[4] = {224,160,96,64};
#ifndef _FWP_UTILS_H
#define _FWP_UTILS_H
-#include <time.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
#include <fwp_msgb.h>
#define Kbit 1000
extern const char *ac_to_text[4];
*/
-#define DEBUG
-
-/* TODO: Introduce multilevel debugging massages and printf-like
- * debugging function. */
-
-#ifdef DEBUG
-#define FWP_DEBUG(fmt,args...) printf("fwp: %s: " fmt, __func__ , ##args)
-#define FWP_ERROR(fmt,args...) fprintf(stderr, "fwp: %s: " fmt, __func__ , ##args)
-
-#else
-#define FWP_DEBUG(fmt,args...)
-#define FWP_ERROR(fmt,args...)
-#endif
-
static inline ssize_t
_fwp_sendto(int s, const void *buf, size_t len, int flags,
const fwp_sockaddr_t *sockaddr)
#include "fwp_msgq.h"
#include "fwp_endpoint.h"
+#include "fwp_debug.h"
#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
static void* fwp_vres_tx_thread(void *_vres);
#include <errno.h>
#include <stdio.h>
+#include <arpa/inet.h>
int main()
{
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
+#include <arpa/inet.h>
#define MSGN 2
char buffer[30];
fwp_addr_t from;
- FWP_DEBUG("Creating receive endpoint\n");
+ printf("Creating receive endpoint\n");
if (fwp_receive_endpoint_create(7777, &attr,&repoint_d1) < 0){
perror("Error while creating receive endpoint\n");
return NULL;
}
- FWP_DEBUG("Receive endpoint created \n");
+ printf("Receive endpoint created \n");
for (i = 0; i < MSGN; i++) {
if ((len = fwp_recv(repoint_d1, buffer, sizeof(buffer), &from,
0)) < 0) {
fwp_send_endpoint_bind(sepoint_d1, vres_d1);
fwp_send(sepoint_d1, msg1, sizeof(msg1), 0);
- FWP_DEBUG("Sent msg1\n");
+ printf("Sent msg1\n");
fwp_send(sepoint_d1, msg2, sizeof(msg2), 0);
- FWP_DEBUG("Sent msg2\n");
+ printf("Sent msg2\n");
pthread_join(thread, (void**) NULL);
/*if (fwp_vres_destroy(vres_d1) < 0) {
#include <errno.h>
#include <stdio.h>
+#include <arpa/inet.h>
+#include <time.h>
#define NUM 10000
fwp_send(sepoint_d1, msg1, sizeof(msg1), 0);
clock_gettime(CLOCK_MONOTONIC, &sendtime);
- FWP_DEBUG("Sent: sec = %ld nsec = %ld \n", sendtime.tv_sec,
- sendtime.tv_nsec);
+ printf("Sent: sec = %ld nsec = %ld \n", sendtime.tv_sec,
+ sendtime.tv_nsec);
if ((len = fwp_recv(repoint_d, buffer, sizeof(buffer), &from, 0)) < 0) {
perror("Error while receiving data");
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
+#include <unistd.h>
+
+#include <arpa/inet.h>
+#include <fwp_utils.h>
#define NUM 20
#define PORT 65111
else printf("Received - %s\n", buffer);
clock_gettime(CLOCK_MONOTONIC, &recvtime);
- FWP_DEBUG("Received %d: sec = %ld nsec = %ld \n", count,
- recvtime.tv_sec, recvtime.tv_nsec);
+ printf("Received %d: sec = %ld nsec = %ld \n", count,
+ recvtime.tv_sec, recvtime.tv_nsec);
}
exit_flag = 1;
#include "fwp_admctrl.h"
#include <ul_log.h>
#include <ul_logreg.h>
+#include "fwp_utils.h"
UL_LOG_CUST(ulogd_fwp_admctrl);
ul_log_domain_t ulogd_fwp_admctrl = {UL_LOGL_MSG, "fwp_admctrl"};