summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-29 20:14:27 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-07-29 20:14:27 +0200
commitd939483328489fb835bb425d36f7c7c73d52c388 (patch)
tree6606976116208fe89ddd76f2a5a22c18d32c27cf
parente3afaa0b7ff373d89fd3fa257110a34df7495df7 (diff)
Remove useless cstate.c file
-rw-r--r--sdpd/Makefile.am2
-rw-r--r--sdpd/cstate.c95
-rw-r--r--sdpd/request.c39
-rw-r--r--sdpd/sdpd.h1
-rw-r--r--sdpd/service.c18
5 files changed, 57 insertions, 98 deletions
diff --git a/sdpd/Makefile.am b/sdpd/Makefile.am
index 6ce2f85b..8e599f26 100644
--- a/sdpd/Makefile.am
+++ b/sdpd/Makefile.am
@@ -2,7 +2,7 @@
noinst_LIBRARIES = libsdpserver.a
libsdpserver_a_SOURCES = \
- sdpd.h server.c cstate.c request.c service.c servicedb.c
+ sdpd.h server.c request.c service.c servicedb.c
AM_CFLAGS = @BLUEZ_CFLAGS@ @GLIB_CFLAGS@
diff --git a/sdpd/cstate.c b/sdpd/cstate.c
deleted file mode 100644
index d0adf08a..00000000
--- a/sdpd/cstate.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2001-2002 Nokia Corporation
- * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2008 Marcel Holtmann <marcel@holtmann.org>
- * Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
-
-#include "sdpd.h"
-
-typedef struct _sdp_cstate_list sdp_cstate_list_t;
-
-struct _sdp_cstate_list {
- sdp_cstate_list_t *next;
- uint32_t timestamp;
- sdp_buf_t buf;
-};
-
-static sdp_cstate_list_t *cstates;
-
-// FIXME: should probably remove it when it's found
-sdp_buf_t *sdp_get_cached_rsp(sdp_cont_state_t *cstate)
-{
- sdp_cstate_list_t *p;
-
- for (p = cstates; p; p = p->next)
- if (p->timestamp == cstate->timestamp)
- return &p->buf;
- return 0;
-}
-
-uint32_t sdp_cstate_alloc_buf(sdp_buf_t *buf)
-{
- sdp_cstate_list_t *cstate = malloc(sizeof(sdp_cstate_list_t));
- uint8_t *data = malloc(buf->data_size);
-
- memcpy(data, buf->data, buf->data_size);
- memset((char *)cstate, 0, sizeof(sdp_cstate_list_t));
- cstate->buf.data = data;
- cstate->buf.data_size = buf->data_size;
- cstate->buf.buf_size = buf->data_size;
- cstate->timestamp = sdp_get_time();
- cstate->next = cstates;
- cstates = cstate;
- return cstate->timestamp;
-}
-
-/*
- * A simple function which returns the time of day in
- * seconds. Used for updating the service db state
- * attribute of the service record of the SDP server
- */
-uint32_t sdp_get_time()
-{
- /*
- * To handle failure in gettimeofday, so an old
- * value is returned and service does not fail
- */
- static struct timeval tm;
-
- gettimeofday(&tm, NULL);
- return (uint32_t) tm.tv_sec;
-}
diff --git a/sdpd/request.c b/sdpd/request.c
index 9020dd38..ece8cd54 100644
--- a/sdpd/request.c
+++ b/sdpd/request.c
@@ -45,7 +45,44 @@
#include "sdpd.h"
#include "logging.h"
-#define MIN(x, y) ((x) < (y))? (x): (y)
+#define MIN(x, y) ((x) < (y)) ? (x): (y)
+
+typedef struct _sdp_cstate_list sdp_cstate_list_t;
+
+struct _sdp_cstate_list {
+ sdp_cstate_list_t *next;
+ uint32_t timestamp;
+ sdp_buf_t buf;
+};
+
+static sdp_cstate_list_t *cstates;
+
+// FIXME: should probably remove it when it's found
+sdp_buf_t *sdp_get_cached_rsp(sdp_cont_state_t *cstate)
+{
+ sdp_cstate_list_t *p;
+
+ for (p = cstates; p; p = p->next)
+ if (p->timestamp == cstate->timestamp)
+ return &p->buf;
+ return 0;
+}
+
+static uint32_t sdp_cstate_alloc_buf(sdp_buf_t *buf)
+{
+ sdp_cstate_list_t *cstate = malloc(sizeof(sdp_cstate_list_t));
+ uint8_t *data = malloc(buf->data_size);
+
+ memcpy(data, buf->data, buf->data_size);
+ memset((char *)cstate, 0, sizeof(sdp_cstate_list_t));
+ cstate->buf.data = data;
+ cstate->buf.data_size = buf->data_size;
+ cstate->buf.buf_size = buf->data_size;
+ cstate->timestamp = sdp_get_time();
+ cstate->next = cstates;
+ cstates = cstate;
+ return cstate->timestamp;
+}
/* Additional values for checking datatype (not in spec) */
#define SDP_TYPE_UUID 0xfe
diff --git a/sdpd/sdpd.h b/sdpd/sdpd.h
index 30f05df4..332b434d 100644
--- a/sdpd/sdpd.h
+++ b/sdpd/sdpd.h
@@ -62,7 +62,6 @@ typedef struct {
sdp_buf_t *sdp_get_cached_rsp(sdp_cont_state_t *cstate);
void sdp_cstate_cache_init(void);
void sdp_cstate_clean_buf(void);
-uint32_t sdp_cstate_alloc_buf(sdp_buf_t *buf);
void sdp_svcdb_reset(void);
void sdp_svcdb_collect_all(int sock);
diff --git a/sdpd/service.c b/sdpd/service.c
index 002efc85..09459f43 100644
--- a/sdpd/service.c
+++ b/sdpd/service.c
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <sys/time.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
@@ -61,6 +62,23 @@ static sdp_version_t sdpVnumArray[1] = {
static const int sdpServerVnumEntries = 1;
/*
+ * A simple function which returns the time of day in
+ * seconds. Used for updating the service db state
+ * attribute of the service record of the SDP server
+ */
+uint32_t sdp_get_time()
+{
+ /*
+ * To handle failure in gettimeofday, so an old
+ * value is returned and service does not fail
+ */
+ static struct timeval tm;
+
+ gettimeofday(&tm, NULL);
+ return (uint32_t) tm.tv_sec;
+}
+
+/*
* The service database state is an attribute of the service record
* of the SDP server itself. This attribute is guaranteed to
* change if any of the contents of the service repository