This commit is contained in:
Babak Farrokhi 2015-10-20 17:09:30 +03:30
commit 23785e3df1
3 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,7 @@
PREFIX=/usr/local
PREFIX?=/usr/local
INC=-I$(PREFIX)/include
LIB=-L$(PREFIX)/lib -L. -lpidfile
CFLAGS=-Wall -g -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
CFLAGS=-Wall -Wextra -g -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
CC?=cc
AR?=AR
RANLIB?=ranlib
@ -20,5 +20,5 @@ fsipd: fsipd.c $(LIBPIDFILE)
$(CC) $(CFLAGS) $(INC) $(LIB) fsipd.c -o fsipd
clean:
rm -f *.o a.out core temp.* $(LIBPIDFILE) $(PROGS)
rm -f *.o *.a a.out core temp.* $(LIBPIDFILE) $(PROGS)
rm -fr *.dSYM

11
fsipd.c
View File

@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <err.h>
#include <errno.h>
@ -89,12 +90,8 @@ process_request(char *str)
{
/* check input str for SIP requests */
/*
* TODO: log connection info including SRC/DST IP, SRC/DST PORT,
* Timestamp and Message Type in CSV Format
*/
syslog(LOG_ALERT, "incoming packet: %s\n", str);
syslog(LOG_ALERT, "sip: %s, sport: %d, payload: \"%s\"\n",
inet_ntoa(sa.sin_addr), ntohs(sa.sin_port), str);
}
/*
@ -208,7 +205,7 @@ daemon_start()
}
int
main(int argc, char *argv[])
main(void)
{
return (daemon_start());
}

View File

@ -125,7 +125,8 @@ struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr)
struct pidfh *pfh;
struct timespec rqtp;
struct stat sb;
int len, fd, error, count;
size_t len;
int fd, error, count;
pfh = malloc(sizeof(*pfh));
if (pfh == NULL) return NULL;