diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c
index cd09af2..633036b 100644
--- a/obexd/plugins/filesystem.c
+++ b/obexd/plugins/filesystem.c
#define FL_TYPE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\">" EOL_CHARS
#define FL_TYPE_PCSUITE "<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\"" EOL_CHARS \
- " [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]>" EOL_CHARS
+ " [ <!ATTLIST folder mem-type CDATA #IMPLIED> ]>" EOL_CHARS
#define FL_BODY_BEGIN "<folder-listing version=\"1.0\">" EOL_CHARS
" modified=\"%s\" mem-type=\"DEV\"" \
" created=\"%s\"/>" EOL_CHARS
-static const guint8 FTP_TARGET[TARGET_SIZE] = {
+static const uint8_t FTP_TARGET[TARGET_SIZE] = {
0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,
0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
#define PCSUITE_WHO_SIZE 8
-static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
+static const uint8_t PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
'P','C',' ','S','u','i','t','e' };
-static gchar *file_stat_line(gchar *filename, struct stat *fstat,
- struct stat *dstat, gboolean root,
- gboolean pcsuite)
+static char *file_stat_line(char *filename, struct stat *fstat,
+ struct stat *dstat, gboolean root,
+ gboolean pcsuite)
{
- gchar perm[51], atime[18], ctime[18], mtime[18];
- gchar *escaped, *ret = NULL;
+ char perm[51], atime[18], ctime[18], mtime[18];
+ char *escaped, *ret = NULL;
snprintf(perm, 50, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" "
"other-perm=\"%s%s%s\"",
mtime, ctime);
else
ret = g_strdup_printf(FL_FOLDER_ELEMENT, escaped, perm,
- atime, mtime, ctime);
+ atime, mtime, ctime);
} else if (S_ISREG(fstat->st_mode))
ret = g_strdup_printf(FL_FILE_ELEMENT, escaped, fstat->st_size,
- perm, atime, mtime, ctime);
+ perm, atime, mtime, ctime);
g_free(escaped);
return ret;
}
-static gpointer filesystem_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *filesystem_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
struct stat stats;
struct statvfs buf;
return NULL;
}
-static int filesystem_close(gpointer object)
+static int filesystem_close(void *object)
{
if (close(GPOINTER_TO_INT(object)) < 0)
return -errno;
return 0;
}
-static ssize_t filesystem_read(gpointer object, void *buf, size_t count,
- guint8 *hi)
+static ssize_t filesystem_read(void *object, void *buf, size_t count,
+ uint8_t *hi)
{
ssize_t ret;
return ret;
}
-static ssize_t filesystem_write(gpointer object, const void *buf, size_t count)
+static ssize_t filesystem_write(void *object, const void *buf, size_t count)
{
ssize_t ret;
int pid;
int output;
int err;
- guint watch;
+ unsigned int watch;
GString *buffer;
};
-static void script_exited(GPid pid, gint status, gpointer data)
+static void script_exited(GPid pid, int status, void *data)
{
struct capability_object *object = data;
char buf[128];
return pid;
}
-static gpointer capability_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *capability_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
struct capability_object *object = NULL;
- gchar *buf;
+ char *buf;
const char *argv[2];
if (oflag != O_RDONLY)
}
static GString *append_listing(GString *object, const char *name,
- gboolean pcsuite, size_t *size, int *err)
+ gboolean pcsuite, size_t *size, int *err)
{
struct stat fstat, dstat;
struct dirent *ep;
DIR *dp;
gboolean root, symlinks;
- gint ret;
+ int ret;
root = g_str_equal(name, obex_option_root_folder());
}
while ((ep = readdir(dp))) {
- gchar *filename;
- gchar *fullname;
- gchar *line;
+ char *filename;
+ char *fullname;
+ char *line;
if (ep->d_name[0] == '.')
continue;
return NULL;
}
-static gpointer folder_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *folder_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
GString *object;
return append_listing(object, name, FALSE, size, err);
}
-static gpointer pcsuite_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *pcsuite_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
GString *object;
return append_listing(object, name, TRUE, size, err);
}
-int string_free(gpointer object)
+int string_free(void *object)
{
GString *string = object;
return 0;
}
-ssize_t string_read(gpointer object, void *buf, size_t count)
+ssize_t string_read(void *object, void *buf, size_t count)
{
GString *string = object;
ssize_t len;
return len;
}
-static ssize_t folder_read(gpointer object, void *buf, size_t count, guint8 *hi)
+static ssize_t folder_read(void *object, void *buf, size_t count, uint8_t *hi)
{
*hi = OBEX_HDR_BODY;
return string_read(object, buf, count);
}
-static ssize_t capability_read(gpointer object, void *buf, size_t count,
- guint8 *hi)
+static ssize_t capability_read(void *object, void *buf, size_t count,
+ uint8_t *hi)
{
struct capability_object *obj = object;
return read(obj->output, buf, count);
}
-static int capability_close(gpointer object)
+static int capability_close(void *object)
{
struct capability_object *obj = object;
diff --git a/obexd/plugins/filesystem.h b/obexd/plugins/filesystem.h
index 636ddb2..712653f 100644
--- a/obexd/plugins/filesystem.h
+++ b/obexd/plugins/filesystem.h
*
*/
-int string_free(gpointer object);
-ssize_t string_read(gpointer object, void *buf, size_t count);
+int string_free(void *object);
+ssize_t string_read(void *object, void *buf, size_t count);
diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index ffb00ff..945cfca 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
#define LST_TYPE "x-obex/folder-listing"
#define CAP_TYPE "x-obex/capability"
-#define FTP_CHANNEL 10
-#define FTP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
-<record> \
- <attribute id=\"0x0001\"> \
- <sequence> \
- <uuid value=\"0x1106\"/> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0004\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x0100\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0003\"/> \
- <uint8 value=\"%u\" name=\"channel\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0008\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0009\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x1106\"/> \
- <uint16 value=\"0x0100\" name=\"version\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0100\"> \
- <text value=\"%s\" name=\"name\"/> \
- </attribute> \
+#define FTP_CHANNEL 10
+#define FTP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
+<record> \
+ <attribute id=\"0x0001\"> \
+ <sequence> \
+ <uuid value=\"0x1106\"/> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0004\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x0100\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0003\"/> \
+ <uint8 value=\"%u\" name=\"channel\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0008\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0009\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x1106\"/> \
+ <uint16 value=\"0x0100\" name=\"version\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0100\"> \
+ <text value=\"%s\" name=\"name\"/> \
+ </attribute> \
</record>"
-#define PCSUITE_CHANNEL 24
+#define PCSUITE_CHANNEL 24
#define PCSUITE_WHO_SIZE 8
-#define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
-<record> \
- <attribute id=\"0x0001\"> \
- <sequence> \
- <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0004\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x0100\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0003\"/> \
- <uint8 value=\"%u\" name=\"channel\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0008\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0005\"> \
- <sequence> \
- <uuid value=\"0x1002\"/> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0009\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
- <uint16 value=\"0x0100\" name=\"version\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0100\"> \
- <text value=\"%s\" name=\"name\"/> \
- </attribute> \
+
+#define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
+<record> \
+ <attribute id=\"0x0001\"> \
+ <sequence> \
+ <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0004\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x0100\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0003\"/> \
+ <uint8 value=\"%u\" name=\"channel\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0008\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0005\"> \
+ <sequence> \
+ <uuid value=\"0x1002\"/> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0009\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
+ <uint16 value=\"0x0100\" name=\"version\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0100\"> \
+ <text value=\"%s\" name=\"name\"/> \
+ </attribute> \
</record>"
-static const guint8 FTP_TARGET[TARGET_SIZE] = {
- 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,
- 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
+static const uint8_t FTP_TARGET[TARGET_SIZE] = {
+ 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,
+ 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
-static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
+static const uint8_t PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
'P','C',' ','S','u','i','t','e' };
struct ftp_session {
struct obex_session *os;
- gchar *folder;
+ char *folder;
};
static void set_folder(struct ftp_session *ftp, const char *new_folder)
ftp->folder = new_folder ? g_strdup(new_folder) : NULL;
}
-static gint get_by_type(struct ftp_session *ftp, const gchar *type)
+static int get_by_type(struct ftp_session *ftp, const char *type)
{
struct obex_session *os = ftp->os;
const char *capability = obex_get_capability_path(os);
return -ENOENT;
}
-static gpointer ftp_connect(struct obex_session *os, int *err)
+static void *ftp_connect(struct obex_session *os, int *err)
{
struct ftp_session *ftp;
const char *root_folder;
}
static int ftp_get(struct obex_session *os, obex_object_t *obj,
- gboolean *stream, gpointer user_data)
+ gboolean *stream, void *user_data)
{
struct ftp_session *ftp = user_data;
const char *type = obex_get_type(os);
return 0;
}
-static gint ftp_delete(struct ftp_session *ftp, const char *name)
+static int ftp_delete(struct ftp_session *ftp, const char *name)
{
- gchar *path;
+ char *path;
int ret = 0;
if (!(ftp->folder && name))
return ret;
}
-static gint ftp_chkput(struct obex_session *os, gpointer user_data)
+static int ftp_chkput(struct obex_session *os, void *user_data)
{
struct ftp_session *ftp = user_data;
- const gchar *name = obex_get_name(os);
- gchar *path;
+ const char *name = obex_get_name(os);
+ char *path;
int ret;
if (name == NULL)
return ret;
}
-static int ftp_put(struct obex_session *os, gpointer user_data)
+static int ftp_put(struct obex_session *os, void *user_data)
{
struct ftp_session *ftp = user_data;
const char *name = obex_get_name(os);
}
static int ftp_setpath(struct obex_session *os, obex_object_t *obj,
- gpointer user_data)
+ void *user_data)
{
struct ftp_session *ftp = user_data;
- const gchar *root_folder, *name;
- guint8 *nonhdr;
- gchar *fullname;
+ const char *root_folder, *name;
+ uint8_t *nonhdr;
+ char *fullname;
struct stat dstat;
gboolean root;
int err;
return err;
}
-static void ftp_disconnect(struct obex_session *os, gpointer user_data)
+static void ftp_disconnect(struct obex_session *os, void *user_data)
{
struct ftp_session *ftp = user_data;
diff --git a/obexd/plugins/opp.c b/obexd/plugins/opp.c
index 729c2ef..01afe76 100644
--- a/obexd/plugins/opp.c
+++ b/obexd/plugins/opp.c
#define OPP_CHANNEL 9
#define OPP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
-<record> \
- <attribute id=\"0x0001\"> \
- <sequence> \
- <uuid value=\"0x1105\"/> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0004\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x0100\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0003\"/> \
- <uint8 value=\"%u\" name=\"channel\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0008\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0009\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x1105\"/> \
- <uint16 value=\"0x0100\" name=\"version\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0100\"> \
- <text value=\"%s\" name=\"name\"/> \
- </attribute> \
- \
- <attribute id=\"0x0303\"> \
- <sequence> \
- <uint8 value=\"0x01\"/> \
- <uint8 value=\"0x01\"/> \
- <uint8 value=\"0x02\"/> \
- <uint8 value=\"0x03\"/> \
- <uint8 value=\"0x04\"/> \
- <uint8 value=\"0x05\"/> \
- <uint8 value=\"0x06\"/> \
- <uint8 value=\"0xff\"/> \
- </sequence> \
- </attribute> \
+<record> \
+ <attribute id=\"0x0001\"> \
+ <sequence> \
+ <uuid value=\"0x1105\"/> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0004\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x0100\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0003\"/> \
+ <uint8 value=\"%u\" name=\"channel\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0008\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0009\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x1105\"/> \
+ <uint16 value=\"0x0100\" name=\"version\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0100\"> \
+ <text value=\"%s\" name=\"name\"/> \
+ </attribute> \
+ \
+ <attribute id=\"0x0303\"> \
+ <sequence> \
+ <uint8 value=\"0x01\"/> \
+ <uint8 value=\"0x01\"/> \
+ <uint8 value=\"0x02\"/> \
+ <uint8 value=\"0x03\"/> \
+ <uint8 value=\"0x04\"/> \
+ <uint8 value=\"0x05\"/> \
+ <uint8 value=\"0x06\"/> \
+ <uint8 value=\"0xff\"/> \
+ </sequence> \
+ </attribute> \
</record>"
-static gpointer opp_connect(struct obex_session *os, int *err)
+static void *opp_connect(struct obex_session *os, int *err)
{
manager_register_transfer(os);
return NULL;
}
-static void opp_progress(struct obex_session *os, gpointer user_data)
+static void opp_progress(struct obex_session *os, void *user_data)
{
manager_emit_transfer_progress(os);
}
-static gint opp_chkput(struct obex_session *os, gpointer user_data)
+static int opp_chkput(struct obex_session *os, void *user_data)
{
- gchar *folder, *name;
- gchar *path;
- gint32 time;
- gint ret;
+ char *folder, *name;
+ char *path;
+ int32_t time;
+ int ret;
if (obex_get_size(os) == OBJECT_SIZE_DELETE)
return -EINVAL;
return ret;
}
-static int opp_put(struct obex_session *os, gpointer user_data)
+static int opp_put(struct obex_session *os, void *user_data)
{
const char *name = obex_get_name(os);
const char *folder = obex_get_root_folder(os);
}
static int opp_get(struct obex_session *os, obex_object_t *obj,
- gboolean *stream, gpointer user_data)
+ gboolean *stream, void *user_data)
{
const char *type;
return 0;
}
-static void opp_disconnect(struct obex_session *os, gpointer user_data)
+static void opp_disconnect(struct obex_session *os, void *user_data)
{
manager_unregister_transfer(os);
}
-static void opp_reset(struct obex_session *os, gpointer user_data)
+static void opp_reset(struct obex_session *os, void *user_data)
{
manager_emit_transfer_completed(os);
}
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 36e5206..efa2445 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
#define PBAP_CHANNEL 15
#define PBAP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
-<record> \
- <attribute id=\"0x0001\"> \
- <sequence> \
- <uuid value=\"0x112f\"/> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0004\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x0100\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0003\"/> \
- <uint8 value=\"%u\" name=\"channel\"/> \
- </sequence> \
- <sequence> \
- <uuid value=\"0x0008\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0009\"> \
- <sequence> \
- <sequence> \
- <uuid value=\"0x1130\"/> \
- <uint16 value=\"0x0100\" name=\"version\"/> \
- </sequence> \
- </sequence> \
- </attribute> \
- \
- <attribute id=\"0x0100\"> \
- <text value=\"%s\" name=\"name\"/> \
- </attribute> \
- \
- <attribute id=\"0x0314\"> \
- <uint8 value=\"0x01\"/> \
- </attribute> \
+<record> \
+ <attribute id=\"0x0001\"> \
+ <sequence> \
+ <uuid value=\"0x112f\"/> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0004\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x0100\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0003\"/> \
+ <uint8 value=\"%u\" name=\"channel\"/> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0008\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0009\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x1130\"/> \
+ <uint16 value=\"0x0100\" name=\"version\"/> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ \
+ <attribute id=\"0x0100\"> \
+ <text value=\"%s\" name=\"name\"/> \
+ </attribute> \
+ \
+ <attribute id=\"0x0314\"> \
+ <uint8 value=\"0x01\"/> \
+ </attribute> \
</record>"
struct aparam_header {
- uint8_t tag;
- uint8_t len;
- uint8_t val[0];
+ uint8_t tag;
+ uint8_t len;
+ uint8_t val[0];
} __attribute__ ((packed));
struct cache {
gboolean valid;
- guint32 index;
- gchar *folder;
+ uint32_t index;
+ char *folder;
GSList *entries;
};
struct cache_entry {
- guint32 handle;
- gchar *id;
- gchar *name;
- gchar *sound;
- gchar *tel;
+ uint32_t handle;
+ char *id;
+ char *name;
+ char *sound;
+ char *tel;
};
struct pbap_session {
struct apparam_field *params;
- gchar *folder;
+ char *folder;
uint32_t find_handle;
GString *buffer;
struct cache cache;
};
-static const guint8 PBAP_TARGET[TARGET_SIZE] = {
+static const uint8_t PBAP_TARGET[TARGET_SIZE] = {
0x79, 0x61, 0x35, 0xF0, 0xF0, 0xC5, 0x11, 0xD8,
0x09, 0x66, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66 };
typedef int (*cache_entry_find_f) (const struct cache_entry *entry,
- const gchar *value);
+ const char *value);
static void cache_entry_free(struct cache_entry *entry)
{
}
static gboolean entry_name_find(const struct cache_entry *entry,
- const gchar *value)
+ const char *value)
{
- gchar *name;
+ char *name;
gboolean ret;
if (!entry->name)
}
static gboolean entry_sound_find(const struct cache_entry *entry,
- const gchar *value)
+ const char *value)
{
if (!entry->sound)
return FALSE;
}
static gboolean entry_tel_find(const struct cache_entry *entry,
- const gchar *value)
+ const char *value)
{
if (!entry->tel)
return FALSE;
return (g_strstr_len(entry->tel, -1, value) ? TRUE : FALSE);
}
-static const gchar *cache_find(struct cache *cache, guint32 handle)
+static const char *cache_find(struct cache *cache, uint32_t handle)
{
GSList *l;
cache->entries = NULL;
}
-static void phonebook_size_result(const gchar *buffer, size_t bufsize,
- gint vcards, gint missed, gpointer user_data)
+static void phonebook_size_result(const char *buffer, size_t bufsize,
+ int vcards, int missed, void *user_data)
{
struct pbap_session *pbap = user_data;
- gchar aparam[4];
+ char aparam[4];
struct aparam_header *hdr = (struct aparam_header *) aparam;
- guint16 phonebooksize;
+ uint16_t phonebooksize;
phonebooksize = htons(vcards);
obex_object_set_io_flags(pbap, G_IO_IN, 0);
}
-static void query_result(const gchar *buffer, size_t bufsize, gint vcards,
- gint missed, gpointer user_data)
+static void query_result(const char *buffer, size_t bufsize, int vcards,
+ int missed, void *user_data)
{
struct pbap_session *pbap = user_data;
obex_object_set_io_flags(pbap, G_IO_IN, 0);
}
-static void cache_entry_notify(const gchar *id, guint32 handle,
- const gchar *name, const gchar *sound,
- const gchar *tel, gpointer user_data)
+static void cache_entry_notify(const char *id, uint32_t handle,
+ const char *name, const char *sound,
+ const char *tel, void *user_data)
{
struct pbap_session *pbap = user_data;
struct cache_entry *entry = g_new0(struct cache_entry, 1);
* when the attribute is not provided.
*/
switch (search_attrib) {
+ /* Number */
case 1:
- /* Number */
find = entry_tel_find;
break;
- /* Sound */
+ /* Sound */
case 2:
find = entry_sound_find;
break;
for (; l; l = l->next) {
struct cache_entry *entry = l->data;
- if (searchval && !find(entry, (const gchar *) searchval))
+ if (searchval && !find(entry, (const char *) searchval))
continue;
sorted = g_slist_insert_sorted(sorted, entry, sort);
pbap->buffer = g_string_append(pbap->buffer, VCARD_LISTING_END);
g_slist_free(sorted);
+
done:
if (!pbap->cache.valid) {
pbap->cache.valid = TRUE;
id = cache_find(&pbap->cache, pbap->find_handle);
- ret = phonebook_get_entry(pbap->folder, id, pbap->params, query_result,
- pbap);
+ ret = phonebook_get_entry(pbap->folder, id, pbap->params,
+ query_result, pbap);
if (ret < 0)
obex_object_set_io_flags(pbap, G_IO_ERR, ret);
}
-static struct apparam_field *parse_aparam(const guint8 *buffer, guint32 hlen)
+static struct apparam_field *parse_aparam(const uint8_t *buffer, uint32_t hlen)
{
struct apparam_field *param;
struct aparam_header *hdr;
- guint64 val64;
- guint32 len = 0;
- guint16 val16;
+ uint64_t val64;
+ uint32_t len = 0;
+ uint16_t val16;
param = g_new0(struct apparam_field, 1);
return NULL;
}
-static gpointer pbap_connect(struct obex_session *os, int *err)
+static void *pbap_connect(struct obex_session *os, int *err)
{
struct pbap_session *pbap;
}
static int pbap_get(struct obex_session *os, obex_object_t *obj,
- gboolean *stream, gpointer user_data)
+ gboolean *stream, void *user_data)
{
struct pbap_session *pbap = user_data;
- const gchar *type = obex_get_type(os);
- const gchar *name = obex_get_name(os);
+ const char *type = obex_get_type(os);
+ const char *name = obex_get_name(os);
struct apparam_field *params;
- const guint8 *buffer;
- gchar *path;
+ const uint8_t *buffer;
+ char *path;
ssize_t rsize;
- gint ret;
+ int ret;
if (type == NULL)
return -EBADR;
}
static int pbap_setpath(struct obex_session *os, obex_object_t *obj,
- gpointer user_data)
+ void *user_data)
{
struct pbap_session *pbap = user_data;
- const gchar *name;
- guint8 *nonhdr;
- gchar *fullname;
+ const char *name;
+ uint8_t *nonhdr;
+ char *fullname;
int err;
if (OBEX_ObjectGetNonHdrData(obj, &nonhdr) != 2) {
return 0;
}
-static void pbap_disconnect(struct obex_session *os, gpointer user_data)
+static void pbap_disconnect(struct obex_session *os, void *user_data)
{
struct pbap_session *pbap = user_data;
g_free(pbap);
}
-static gint pbap_chkput(struct obex_session *os, gpointer user_data)
+static int pbap_chkput(struct obex_session *os, void *user_data)
{
/* Rejects all PUTs */
return -EINVAL;
.chkput = pbap_chkput
};
-static gpointer vobject_pull_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *vobject_pull_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
phonebook_cb cb;
return NULL;
}
-static gpointer vobject_list_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *vobject_list_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
int ret;
return NULL;
}
-static gpointer vobject_vcard_open(const char *name, int oflag, mode_t mode,
- gpointer context, size_t *size, int *err)
+static void *vobject_vcard_open(const char *name, int oflag, mode_t mode,
+ void *context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
- const gchar *id;
- guint32 handle;
+ const char *id;
+ uint32_t handle;
int ret;
if (oflag != O_RDONLY) {
return NULL;
}
-static ssize_t vobject_pull_read(gpointer object, void *buf, size_t count,
- guint8 *hi)
+static ssize_t vobject_pull_read(void *object, void *buf, size_t count,
+ uint8_t *hi)
{
struct pbap_session *pbap = object;
return string_read(pbap->buffer, buf, count);
}
-static ssize_t vobject_list_read(gpointer object, void *buf, size_t count,
- guint8 *hi)
+static ssize_t vobject_list_read(void *object, void *buf, size_t count,
+ uint8_t *hi)
{
struct pbap_session *pbap = object;
return string_read(pbap->buffer, buf, count);
}
-static ssize_t vobject_vcard_read(gpointer object, void *buf, size_t count,
- guint8 *hi)
+static ssize_t vobject_vcard_read(void *object, void *buf, size_t count,
+ uint8_t *hi)
{
struct pbap_session *pbap = object;
return string_read(pbap->buffer, buf, count);
}
-static int vobject_close(gpointer object)
+static int vobject_close(void *object)
{
struct pbap_session *pbap = object;
}
static struct obex_mime_type_driver mime_pull = {
- .target = PBAP_TARGET,
- .mimetype = "x-bt/phonebook",
- .open = vobject_pull_open,
- .close = vobject_close,
- .read = vobject_pull_read,
+ .target = PBAP_TARGET,
+ .mimetype = "x-bt/phonebook",
+ .open = vobject_pull_open,
+ .close = vobject_close,
+ .read = vobject_pull_read,
};
static struct obex_mime_type_driver mime_list = {
- .target = PBAP_TARGET,
- .mimetype = "x-bt/vcard-listing",
- .open = vobject_list_open,
- .close = vobject_close,
- .read = vobject_list_read,
+ .target = PBAP_TARGET,
+ .mimetype = "x-bt/vcard-listing",
+ .open = vobject_list_open,
+ .close = vobject_close,
+ .read = vobject_list_read,
};
static struct obex_mime_type_driver mime_vcard = {
- .target = PBAP_TARGET,
- .mimetype = "x-bt/vcard",
- .open = vobject_vcard_open,
- .close = vobject_close,
- .read = vobject_vcard_read,
+ .target = PBAP_TARGET,
+ .mimetype = "x-bt/vcard",
+ .open = vobject_vcard_open,
+ .close = vobject_close,
+ .read = vobject_vcard_read,
};
static int pbap_init(void)
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 9765b3e..019b797 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
typedef void (*vcard_func_t) (const char *file, VObject *vo, void *user_data);
struct dummy_data {
- phonebook_cb cb;
- gpointer user_data;
+ phonebook_cb cb;
+ void *user_data;
const struct apparam_field *apparams;
char *folder;
int fd;
DIR *dp;
};
-static gchar *root_folder = NULL;
+static char *root_folder = NULL;
-static void dummy_free(gpointer user_data)
+static void dummy_free(void *user_data)
{
struct dummy_data *dummy = user_data;
*/
for (l = g_slist_nth(sorted, offset);
l && n < maxlistcount; l = l->next) {
- const gchar *filename = l->data;
+ const char *filename = l->data;
fd = openat(folderfd, filename, O_RDONLY);
if (fd < 0) {
return FALSE;
}
-static gboolean read_entry(gpointer user_data)
+static gboolean read_entry(void *user_data)
{
struct dummy_data *dummy = user_data;
char buffer[1024];
return S_ISDIR(st.st_mode);
}
-gchar *phonebook_set_folder(const gchar *current_folder,
- const gchar *new_folder, guint8 flags, int *err)
+char *phonebook_set_folder(const char *current_folder,
+ const char *new_folder, uint8_t flags, int *err)
{
gboolean root, child;
- gchar *tmp1, *tmp2, *base, *absolute, *relative = NULL;
+ char *tmp1, *tmp2, *base, *absolute, *relative = NULL;
int ret, len;
root = (g_strcmp0("/", current_folder) == 0);
return relative;
}
-int phonebook_pull(const gchar *name, const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data)
+int phonebook_pull(const char *name, const struct apparam_field *params,
+ phonebook_cb cb, void *user_data)
{
struct dummy_data *dummy;
char *filename, *folder;
return 0;
}
-int phonebook_get_entry(const gchar *folder, const gchar *id,
+int phonebook_get_entry(const char *folder, const char *id,
const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data)
+ phonebook_cb cb, void *user_data)
{
struct dummy_data *dummy;
char *filename;
return 0;
}
-int phonebook_create_cache(const gchar *name, phonebook_entry_cb entry_cb,
- phonebook_cache_ready_cb ready_cb, gpointer user_data)
+int phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
+ phonebook_cache_ready_cb ready_cb, void *user_data)
{
struct cache_query *query;
char *foldername;
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index 21278be..c3c22a2 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
struct contacts_query {
const struct apparam_field *params;
phonebook_cb cb;
- gpointer user_data;
+ void *user_data;
};
struct cache_query {
phonebook_entry_cb entry_cb;
phonebook_cache_ready_cb ready_cb;
- gpointer user_data;
+ void *user_data;
};
static EBook *ebook = NULL;
-static gchar *attribute_mask[] = {
+static char *attribute_mask[] = {
/* 0 */ "VERSION",
"FN",
"N",
};
-static gchar *evcard_to_string(EVCard *evcard, guint format, guint64 filter)
+static char *evcard_to_string(EVCard *evcard, unsigned int format,
+ uint64_t filter)
{
EVCard *evcard2;
- gchar *vcard;
- guint i;
+ char *vcard;
+ unsigned int i;
if (!filter)
return e_vcard_to_string(evcard, format);
* Mandatory attributes for vCard 2.1 are VERSION ,N and TEL.
* Mandatory attributes for vCard 3.0 are VERSION, N, FN and TEL
*/
- filter = (format == EVC_FORMAT_VCARD_30 ? filter | 0x85: filter | 0x87);
+ filter = format == EVC_FORMAT_VCARD_30 ? filter | 0x85: filter | 0x87;
evcard2 = e_vcard_new();
for (i = 0; i < 29; i++) {
}
static void ebookpull_cb(EBook *book, EBookStatus estatus, GList *contacts,
- gpointer user_data)
+ void *user_data)
{
struct contacts_query *data = user_data;
GString *string = g_string_new("");
- guint count = 0, maxcount;
+ unsigned int count = 0, maxcount;
GList *l;
if (estatus != E_BOOK_ERROR_OK) {
for (; l && count < maxcount; l = g_list_next(l), count++) {
EContact *contact = E_CONTACT(l->data);
EVCard *evcard = E_VCARD(contact);
- gchar *vcard;
+ char *vcard;
vcard = evcard_to_string(evcard, data->params->format,
data->params->filter);
}
static void ebook_entry_cb(EBook *book, EBookStatus estatus,
- EContact *contact, gpointer user_data)
+ EContact *contact, void *user_data)
{
struct contacts_query *data = user_data;
EVCard *evcard;
- gchar *vcard;
+ char *vcard;
size_t len;
if (estatus != E_BOOK_ERROR_OK) {
g_free(data);
}
-static gchar *evcard_name_attribute_to_string(EVCard *evcard)
+static char *evcard_name_attribute_to_string(EVCard *evcard)
{
EVCardAttribute *attrib;
GList *l;
return NULL;
for (l = e_vcard_attribute_get_values(attrib); l; l = l->next) {
- const gchar *value = l->data;
+ const char *value = l->data;
if (!strlen(value))
continue;
}
static void cache_cb(EBook *book, EBookStatus estatus, GList *contacts,
- gpointer user_data)
+ void *user_data)
{
struct cache_query *data = user_data;
GList *l;
EContact *contact = E_CONTACT(l->data);
EVCard *evcard = E_VCARD(contact);
EVCardAttribute *attrib;
- gchar *uid, *tel, *name;
+ char *uid, *tel, *name;
name = evcard_name_attribute_to_string(evcard);
if (!name)
g_object_unref(ebook);
}
-gchar *phonebook_set_folder(const gchar *current_folder,
- const gchar *new_folder, guint8 flags, int *err)
+char *phonebook_set_folder(const char *current_folder,
+ const char *new_folder, uint8_t flags, int *err)
{
gboolean root, child;
- gchar *fullname = NULL, *tmp1, *tmp2, *base;
+ char *fullname = NULL, *tmp1, *tmp2, *base;
int ret = 0, len;
root = (g_strcmp0("/", current_folder) == 0);
return fullname;
}
-gint phonebook_pull(const gchar *name, const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data)
+int phonebook_pull(const char *name, const struct apparam_field *params,
+ phonebook_cb cb, void *user_data)
{
struct contacts_query *data;
EBookQuery *query;
return 0;
}
-int phonebook_get_entry(const gchar *folder, const gchar *id,
+int phonebook_get_entry(const char *folder, const char *id,
const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data)
+ phonebook_cb cb, void *user_data)
{
struct contacts_query *data;
return 0;
}
-int phonebook_create_cache(const gchar *name, phonebook_entry_cb entry_cb,
- phonebook_cache_ready_cb ready_cb, gpointer user_data)
+int phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
+ phonebook_cache_ready_cb ready_cb, void *user_data)
{
struct cache_query *data;
EBookQuery *query;
e_book_query_unref(query);
- return (ret == FALSE ? 0 : -EBADR);
+ return ret == FALSE ? 0 : -EBADR;
}
diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index a8cbb45..c8ae03b 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
done:
if (num_fields == 0)
- data->cb(vcards->str, vcards->len, data->index, 0, data->user_data);
+ data->cb(vcards->str, vcards->len, data->index, 0,
+ data->user_data);
g_string_free(vcards, TRUE);
}
data->cb = cb;
query = g_strdup_printf(CONTACTS_QUERY_FROM_URI,
- id, id, id, id, id, id, id, id);
+ id, id, id, id, id, id, id, id);
ret = query_tracker(query, 8, pull_contacts, data);;
diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
index 85f69a3..d7cfa46 100644
--- a/obexd/plugins/phonebook.h
+++ b/obexd/plugins/phonebook.h
#define EOL "\r\n"
#define VCARD_LISTING_BEGIN \
- "<?xml version=\"1.0\"?>" EOL\
+ "<?xml version=\"1.0\"?>" EOL\
"<!DOCTYPE vcard-listing SYSTEM \"vcard-listing.dtd\">" EOL\
- "<vCard-listing version=\"1.0\">" EOL
-#define VCARD_LISTING_ELEMENT "<card handle = \"%d.vcf\" name = \"%s\"/>" EOL
-#define VCARD_LISTING_END "</vCard-listing>"
+ "<vCard-listing version=\"1.0\">" EOL
+#define VCARD_LISTING_ELEMENT "<card handle = \"%d.vcf\" name = \"%s\"/>" EOL
+#define VCARD_LISTING_END "</vCard-listing>"
struct apparam_field {
/* list and pull attributes */
- guint16 maxlistcount;
- guint16 liststartoffset;
+ uint16_t maxlistcount;
+ uint16_t liststartoffset;
/* pull and vcard attributes */
- guint64 filter;
- guint8 format;
+ uint64_t filter;
+ uint8_t format;
/* list attributes only */
- guint8 order;
- guint8 searchattrib;
- guint8 *searchval;
+ uint8_t order;
+ uint8_t searchattrib;
+ uint8_t *searchval;
};
/*
* all contacts that match the application parameters rules.
* Contacts will be returned in the vcard format.
*/
-typedef void (*phonebook_cb) (const gchar *buffer, size_t bufsize,
- gint vcards, gint missed, gpointer user_data);
+typedef void (*phonebook_cb) (const char *buffer, size_t bufsize,
+ int vcards, int missed, void *user_data);
/*
* Interface between the PBAP core and backends to
* append a new entry in the PBAP folder cache.
*/
-#define PHONEBOOK_INVALID_HANDLE 0xffffffff
+#define PHONEBOOK_INVALID_HANDLE 0xffffffff
typedef void (*phonebook_entry_cb) (const char *id, uint32_t handle,
const char *name, const char *sound,
const char *tel, void *user_data);
* After notify all entries to PBAP core, the backend
* needs to notify that the operation has finished.
*/
-typedef void (*phonebook_cache_ready_cb) (gpointer user_data);
+typedef void (*phonebook_cache_ready_cb) (void *user_data);
int phonebook_init(void);
* the PBAP virtual folder architecture. Validate the folder's name
* is responsibility of the back-ends.
*/
-gchar *phonebook_set_folder(const gchar *current_folder,
- const gchar *new_folder, guint8 flags, int *err);
+char *phonebook_set_folder(const char *current_folder,
+ const char *new_folder, uint8_t flags, int *err);
/*
* PullPhoneBook never use cached entries. PCE use this function to get all
* entries of a given folder. The back-end MUST return only the content based
* on the application parameters requested by the client.
*/
-int phonebook_pull(const gchar *name, const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data);
+int phonebook_pull(const char *name, const struct apparam_field *params,
+ phonebook_cb cb, void *user_data);
/*
* Function used to retrieve a contact from the backend. Only contacts
* return only the content based on the application parameters requested
* by the client.
*/
-int phonebook_get_entry(const gchar *folder, const gchar *id,
+int phonebook_get_entry(const char *folder, const char *id,
const struct apparam_field *params,
- phonebook_cb cb, gpointer user_data);
+ phonebook_cb cb, void *user_data);
/*
* PBAP core will keep the contacts cache per folder. SetPhoneBook or
* Cache will store only the necessary information required to reply to
* PullvCardListing request and verify if a given contact belongs to the source.
*/
-int phonebook_create_cache(const gchar *name, phonebook_entry_cb entry_cb,
- phonebook_cache_ready_cb ready_cb, gpointer user_data);
+int phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
+ phonebook_cache_ready_cb ready_cb, void *user_data);
diff --git a/obexd/plugins/syncevolution.c b/obexd/plugins/syncevolution.c
index a40497c..87deb17 100644
--- a/obexd/plugins/syncevolution.c
+++ b/obexd/plugins/syncevolution.c
#define SYNCML_TARGET_SIZE 11
-static const guint8 SYNCML_TARGET[SYNCML_TARGET_SIZE] = {
+static const uint8_t SYNCML_TARGET[SYNCML_TARGET_SIZE] = {
0x53, 0x59, 0x4E, 0x43, 0x4D, 0x4C, 0x2D, 0x53,
0x59, 0x4E, 0x43 };
struct synce_context {
struct obex_session *os;
DBusConnection *dbus_conn;
- gchar *conn_obj;
- guint reply_watch;
- guint abort_watch;
+ char *conn_obj;
+ unsigned int reply_watch;
+ unsigned int abort_watch;
GString *buffer;
int lasterr;
- gchar *id;
+ char *id;
};
static void append_dict_entry(DBusMessageIter *dict, const char *key,
}
static gboolean reply_signal(DBusConnection *conn, DBusMessage *msg,
- void *data)
+ void *data)
{
struct synce_context *context = data;
const char *path = dbus_message_get_path(msg);
DBusMessageIter iter, array_iter;
- gchar *value;
- gint length;
+ char *value;
+ int length;
if (strcmp(context->conn_obj, path) != 0) {
obex_object_set_io_flags(context, G_IO_ERR, -EPERM);
}
static gboolean abort_signal(DBusConnection *conn, DBusMessage *msg,
- void *data)
+ void *data)
{
struct synce_context *context = data;
obex_object_set_io_flags(context, G_IO_ERR, -EPERM);
context->lasterr = -EPERM;
+
return TRUE;
}
DBusConnection *conn;
DBusMessage *reply;
DBusError err;
- gchar *path;
+ char *path;
conn = context->dbus_conn;
dbus_message_unref(reply);
}
-static gpointer synce_connect(struct obex_session *os, int *err)
+static void *synce_connect(struct obex_session *os, int *err)
{
DBusConnection *conn;
struct synce_context *context;
return NULL;
}
-static int synce_put(struct obex_session *os, gpointer user_data)
+static int synce_put(struct obex_session *os, void *user_data)
{
return 0;
}
static int synce_get(struct obex_session *os, obex_object_t *obj,
- gboolean *stream, gpointer user_data)
+ gboolean *stream, void *user_data)
{
if (stream)
*stream = TRUE;
dbus_message_unref(reply);
}
-static void synce_disconnect(struct obex_session *os, gpointer user_data)
+static void synce_disconnect(struct obex_session *os, void *user_data)
{
struct synce_context *context = user_data;
g_free(context);
}
-static gpointer synce_open(const char *name, int oflag, mode_t mode,
- gpointer user_data, size_t *size, int *err)
+static void *synce_open(const char *name, int oflag, mode_t mode,
+ void *user_data, size_t *size, int *err)
{
if (err)
*err = 0;
return user_data;
}
-static int synce_close(gpointer object)
+static int synce_close(void *object)
{
struct synce_context *context = object;
DBusMessage *msg;
- const gchar *error;
+ const char *error;
gboolean normal;
DBusPendingCall *call;
return 0;
}
-static ssize_t synce_read(gpointer object, void *buf, size_t count, guint8 *hi)
+static ssize_t synce_read(void *object, void *buf, size_t count, uint8_t *hi)
{
struct synce_context *context = object;
DBusConnection *conn;
- gchar transport[36], transport_description[24];
+ char transport[36], transport_description[24];
const char *session;
DBusMessage *msg;
DBusMessageIter iter, dict;
return -EPERM;
}
-static ssize_t synce_write(gpointer object, const void *buf, size_t count)
+static ssize_t synce_write(void *object, const void *buf, size_t count)
{
struct synce_context *context = object;
DBusMessage *msg;
diff --git a/obexd/plugins/vcard.c b/obexd/plugins/vcard.c
index c0a5f85..4afa12f 100644
--- a/obexd/plugins/vcard.c
+++ b/obexd/plugins/vcard.c
g_free(contact->prefix);
g_free(contact->suffix);
g_free(contact);
-
}
diff --git a/obexd/src/bluetooth.c b/obexd/src/bluetooth.c
index d3f72ba..3687473 100644
--- a/obexd/src/bluetooth.c
+++ b/obexd/src/bluetooth.c
static GSList *servers = NULL;
-static void confirm_event(GIOChannel *io, gpointer user_data)
+static void confirm_event(GIOChannel *io, void *user_data)
{
struct server *server = user_data;
struct obex_service_driver *driver;
GError *err = NULL;
char address[18];
- guint8 channel;
+ uint8_t channel;
bt_io_get(io, BT_IO_RFCOMM, &err,
BT_IO_OPT_DEST, address,
g_io_channel_shutdown(io, TRUE, NULL);
}
-static gint server_start(struct server *server)
+static int server_start(struct server *server)
{
GError *err = NULL;
struct obex_service_driver *driver;
return -EINVAL;
}
-static gint server_stop(struct server *server)
+static int server_stop(struct server *server)
{
if (!server->io)
return -EINVAL;
return 0;
}
-static gint server_register(guint16 service, const gchar *folder,
+static int server_register(uint16_t service, const char *folder,
gboolean secure, gboolean auto_accept,
- gboolean symlinks, const gchar *capability)
+ gboolean symlinks, const char *capability)
{
struct server *server;
GSList *drivers;
return 0;
}
-gint bluetooth_init(guint service, const gchar *folder, gboolean secure,
+int bluetooth_init(unsigned int service, const char *folder, gboolean secure,
gboolean auto_accept, gboolean symlinks,
- const gchar *capability)
+ const char *capability)
{
return server_register(service, folder, secure, auto_accept, symlinks,
- capability);
+ capability);
}
void bluetooth_exit(void)
diff --git a/obexd/src/bluetooth.h b/obexd/src/bluetooth.h
index 4f191a4..1a4e1d8 100644
--- a/obexd/src/bluetooth.h
+++ b/obexd/src/bluetooth.h
#include <config.h>
#endif
-gint bluetooth_init(guint service, const gchar *folder, gboolean secure,
+int bluetooth_init(unsigned int service, const char *folder, gboolean secure,
gboolean auto_accept, gboolean symlinks,
- const gchar *capability);
+ const char *capability);
void bluetooth_exit(void);
void bluetooth_start(void);
void bluetooth_stop(void);
diff --git a/obexd/src/btio.c b/obexd/src/btio.c
index cf91de7..0adbcee 100644
--- a/obexd/src/btio.c
+++ b/obexd/src/btio.c
struct connect {
BtIOConnect connect;
- gpointer user_data;
+ void *user_data;
GDestroyNotify destroy;
};
struct accept {
BtIOConnect connect;
- gpointer user_data;
+ void *user_data;
GDestroyNotify destroy;
};
struct server {
BtIOConnect connect;
BtIOConfirm confirm;
- gpointer user_data;
+ void *user_data;
GDestroyNotify destroy;
};
}
static gboolean accept_cb(GIOChannel *io, GIOCondition cond,
- gpointer user_data)
+ void *user_data)
{
struct accept *accept = user_data;
GError *err = NULL;
}
static gboolean connect_cb(GIOChannel *io, GIOCondition cond,
- gpointer user_data)
+ void *user_data)
{
struct connect *conn = user_data;
GError *gerr = NULL;
}
static gboolean server_cb(GIOChannel *io, GIOCondition cond,
- gpointer user_data)
+ void *user_data)
{
struct server *server = user_data;
int srv_sock, cli_sock;
}
static void server_add(GIOChannel *io, BtIOConnect connect,
- BtIOConfirm confirm, gpointer user_data,
+ BtIOConfirm confirm, void *user_data,
GDestroyNotify destroy)
{
struct server *server;
}
static void connect_add(GIOChannel *io, BtIOConnect connect,
- gpointer user_data, GDestroyNotify destroy)
+ void *user_data, GDestroyNotify destroy)
{
struct connect *conn;
GIOCondition cond;
(GDestroyNotify) connect_remove);
}
-static void accept_add(GIOChannel *io, BtIOConnect connect, gpointer user_data,
+static void accept_add(GIOChannel *io, BtIOConnect connect, void *user_data,
GDestroyNotify destroy)
{
struct accept *accept;
return FALSE;
}
-gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
+gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, void *user_data,
GDestroyNotify destroy, GError **err)
{
int sock;
}
GIOChannel *bt_io_connect(BtIOType type, BtIOConnect connect,
- gpointer user_data, GDestroyNotify destroy,
+ void *user_data, GDestroyNotify destroy,
GError **gerr, BtIOOption opt1, ...)
{
GIOChannel *io;
}
GIOChannel *bt_io_listen(BtIOType type, BtIOConnect connect,
- BtIOConfirm confirm, gpointer user_data,
+ BtIOConfirm confirm, void *user_data,
GDestroyNotify destroy, GError **err,
BtIOOption opt1, ...)
{
diff --git a/obexd/src/btio.h b/obexd/src/btio.h
index 00d743e..7df5972 100644
--- a/obexd/src/btio.h
+++ b/obexd/src/btio.h
BT_IO_SEC_HIGH,
} BtIOSecLevel;
-typedef void (*BtIOConfirm)(GIOChannel *io, gpointer user_data);
+typedef void (*BtIOConfirm)(GIOChannel *io, void *user_data);
-typedef void (*BtIOConnect)(GIOChannel *io, GError *err, gpointer user_data);
+typedef void (*BtIOConnect)(GIOChannel *io, GError *err, void *user_data);
-gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
+gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, void *user_data,
GDestroyNotify destroy, GError **err);
gboolean bt_io_set(GIOChannel *io, BtIOType type, GError **err,
BtIOOption opt1, ...);
GIOChannel *bt_io_connect(BtIOType type, BtIOConnect connect,
- gpointer user_data, GDestroyNotify destroy,
+ void *user_data, GDestroyNotify destroy,
GError **err, BtIOOption opt1, ...);
GIOChannel *bt_io_listen(BtIOType type, BtIOConnect connect,
- BtIOConfirm confirm, gpointer user_data,
+ BtIOConfirm confirm, void *user_data,
GDestroyNotify destroy, GError **err,
BtIOOption opt1, ...);
diff --git a/obexd/src/dbus.h b/obexd/src/dbus.h
index ccafc1e..fe736ca 100644
--- a/obexd/src/dbus.h
+++ b/obexd/src/dbus.h
void manager_emit_transfer_started(struct obex_session *os);
void manager_emit_transfer_progress(struct obex_session *os);
void manager_emit_transfer_completed(struct obex_session *os);
-int manager_request_authorization(struct obex_session *os, gint32 time,
- gchar **new_folder, gchar **new_name);
+int manager_request_authorization(struct obex_session *os, int32_t time,
+ char **new_folder, char **new_name);
DBusConnection *obex_dbus_get_connection(void);
diff --git a/obexd/src/logging.c b/obexd/src/logging.c
index f0a25cb..f42770e 100644
--- a/obexd/src/logging.c
+++ b/obexd/src/logging.c
}
static struct {
- int evt;
- const char *name;
+ int evt;
+ const char *name;
} obex_event[] = {
- { OBEX_EV_PROGRESS, "PROGRESS" }, /* Progress has been made */
- { OBEX_EV_REQHINT, "REQHINT" }, /* An incoming request is about to come */
- { OBEX_EV_REQ, "REQ" }, /* An incoming request has arrived */
- { OBEX_EV_REQDONE, "REQDONE" }, /* Request has finished */
- { OBEX_EV_LINKERR, "LINKERR" }, /* Link has been disconnected */
- { OBEX_EV_PARSEERR, "PARSEERR" }, /* Malformed data encountered */
- { OBEX_EV_ACCEPTHINT, "ACCEPTHINT" }, /* Connection accepted */
- { OBEX_EV_ABORT, "ABORT" }, /* Request was aborted */
- { OBEX_EV_STREAMEMPTY, "STREAMEMPTY" }, /* Need to feed more data when sending a stream */
- { OBEX_EV_STREAMAVAIL, "STREAMAVAIL" }, /* Time to pick up data when receiving a stream */
- { OBEX_EV_UNEXPECTED, "UNEXPECTED" }, /* Unexpected data, not fatal */
- { OBEX_EV_REQCHECK, "REQCHECK" }, /* First packet of an incoming request has been parsed */
+ /* Progress has been made */
+ { OBEX_EV_PROGRESS, "PROGRESS" },
+ /* An incoming request is about to come */
+ { OBEX_EV_REQHINT, "REQHINT" },
+ /* An incoming request has arrived */
+ { OBEX_EV_REQ, "REQ" },
+ /* Request has finished */
+ { OBEX_EV_REQDONE, "REQDONE" },
+ /* Link has been disconnected */
+ { OBEX_EV_LINKERR, "LINKERR" },
+ /* Malformed data encountered */
+ { OBEX_EV_PARSEERR, "PARSEERR" },
+ /* Connection accepted */
+ { OBEX_EV_ACCEPTHINT, "ACCEPTHINT" },
+ /* Request was aborted */
+ { OBEX_EV_ABORT, "ABORT" },
+ /* Need to feed more data when sending a stream */
+ { OBEX_EV_STREAMEMPTY, "STREAMEMPTY" },
+ /* Time to pick up data when receiving a stream */
+ { OBEX_EV_STREAMAVAIL, "STREAMAVAIL" },
+ /* Unexpected data, not fatal */
+ { OBEX_EV_UNEXPECTED, "UNEXPECTED" },
+ /* First packet of an incoming request has been parsed */
+ { OBEX_EV_REQCHECK, "REQCHECK" },
{ 0xFF, NULL },
};
/* Possible commands */
static struct {
- int cmd;
- const char *name;
+ int cmd;
+ const char *name;
} obex_command[] = {
{ OBEX_CMD_CONNECT, "CONNECT" },
{ OBEX_CMD_DISCONNECT, "DISCONNECT" },
/* Possible Response */
static struct {
- int rsp;
- const char *name;
+ int rsp;
+ const char *name;
} obex_response[] = {
{ OBEX_RSP_CONTINUE, "CONTINUE" },
{ OBEX_RSP_SWITCH_PRO, "SWITCH_PRO" },
rspstr = obex_response[i].name;
}
- debug("%s(0x%x), %s(0x%x), %s(0x%x)", evtstr, evt, cmdstr, cmd, rspstr, rsp);
+ debug("%s(0x%x), %s(0x%x), %s(0x%x)", evtstr, evt, cmdstr, cmd,
+ rspstr, rsp);
}
diff --git a/obexd/src/main.c b/obexd/src/main.c
index def0ad3..3408c72 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
#define TTY_RX_MTU 65535
#define TTY_TX_MTU 65535
-int tty_init(int services, const gchar *root_path,
- const gchar *capability, gboolean symlinks,
- const gchar *devnode)
+int tty_init(int services, const char *root_path,
+ const char *capability, gboolean symlinks,
+ const char *devnode)
{
struct server *server;
struct termios options;
static gboolean option_detach = TRUE;
static gboolean option_debug = FALSE;
-static gchar *option_root = NULL;
-static gchar *option_root_setup = NULL;
-static gchar *option_capability = NULL;
-static gchar *option_devnode = NULL;
+static char *option_root = NULL;
+static char *option_root_setup = NULL;
+static char *option_capability = NULL;
+static char *option_devnode = NULL;
static gboolean option_autoaccept = FALSE;
static gboolean option_opp = FALSE;
{ NULL },
};
-const gchar *obex_option_root_folder(void)
+const char *obex_option_root_folder(void)
{
return option_root;
}
static gboolean root_folder_setup(char *root, char *root_setup)
{
- gint status;
+ int status;
char *argv[3] = { root_setup, root, NULL };
if (is_dir(root))
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 8fef605..4eb518c 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
#include "btio.h"
#include "service.h"
-#define OPENOBEX_MANAGER_PATH "/"
-#define OPENOBEX_MANAGER_INTERFACE OPENOBEX_SERVICE ".Manager"
-#define ERROR_INTERFACE OPENOBEX_SERVICE ".Error"
-#define TRANSFER_INTERFACE OPENOBEX_SERVICE ".Transfer"
-#define SESSION_INTERFACE OPENOBEX_SERVICE ".Session"
+#define OPENOBEX_MANAGER_PATH "/"
+#define OPENOBEX_MANAGER_INTERFACE OPENOBEX_SERVICE ".Manager"
+#define ERROR_INTERFACE OPENOBEX_SERVICE ".Error"
+#define TRANSFER_INTERFACE OPENOBEX_SERVICE ".Transfer"
+#define SESSION_INTERFACE OPENOBEX_SERVICE ".Session"
#define TIMEOUT 60*1000 /* Timeout for user response (miliseconds) */
struct agent {
- gchar *bus_name;
- gchar *path;
- gboolean auth_pending;
- gchar *new_name;
- gchar *new_folder;
- guint watch_id;
+ char *bus_name;
+ char *path;
+ gboolean auth_pending;
+ char *new_name;
+ char *new_folder;
+ unsigned int watch_id;
};
static struct agent *agent = NULL;
struct pending_request {
DBusPendingCall *call;
struct server *server;
- gchar *adapter_path;
+ char *adapter_path;
char address[18];
- guint watch;
+ unsigned int watch;
GIOChannel *io;
};
static DBusConnection *connection = NULL;
static DBusConnection *system_conn = NULL;
static struct adapter_any *any = NULL;
-static guint listener_id = 0;
+static unsigned int listener_id = 0;
static void agent_free(struct agent *agent)
{
static DBusMessage *register_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- const gchar *path, *sender;
+ const char *path, *sender;
if (agent)
return agent_already_exists(msg);
static DBusMessage *unregister_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- const gchar *path, *sender;
+ const char *path, *sender;
if (!agent)
return agent_does_not_exist(msg);
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
- gchar *uuid;
+ char *uuid;
reply = dbus_message_new_method_return(msg);
if (!reply)
DBusMessage *msg, void *user_data)
{
struct obex_session *os = user_data;
- const gchar *sender;
+ const char *sender;
if (!os)
return invalid_args(msg);
{ }
};
-static void add_record_reply(DBusPendingCall *call, gpointer user_data)
+static void add_record_reply(DBusPendingCall *call, void *user_data)
{
struct server *server = user_data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
dbus_message_unref(reply);
}
-static gint add_record(const gchar *path,
- const gchar *xml, struct server *server)
+static int add_record(const char *path,
+ const char *xml, struct server *server)
{
DBusMessage *msg;
DBusPendingCall *call;
- gint ret = 0;
+ int ret = 0;
msg = dbus_message_new_method_call("org.bluez", path,
"org.bluez.Service", "AddRecord");
void register_record(struct server *server)
{
struct obex_service_driver *driver;
- gchar *xml;
- gint ret;
+ char *xml;
+ int ret;
if (system_conn == NULL)
return;
g_free(xml);
}
-static void find_adapter_any_reply(DBusPendingCall *call, gpointer user_data)
+static void find_adapter_any_reply(DBusPendingCall *call, void *user_data)
{
DBusMessage *reply = dbus_pending_call_steal_reply(call);
const char *path;
- gchar *xml;
+ char *xml;
GSList *l;
DBusError derr;
static DBusPendingCall *find_adapter(const char *pattern,
DBusPendingCallNotifyFunction function,
- gpointer user_data)
+ void *user_data)
{
DBusMessage *msg;
DBusPendingCall *call;
void manager_emit_transfer_started(struct obex_session *os)
{
- gchar *path = g_strdup_printf("/transfer%u", os->cid);
+ char *path = g_strdup_printf("/transfer%u", os->cid);
g_dbus_emit_signal(connection, OPENOBEX_MANAGER_PATH,
OPENOBEX_MANAGER_INTERFACE, "TransferStarted",
g_free(path);
}
-static void emit_transfer_completed(guint32 id, gboolean success)
+static void emit_transfer_completed(uint32_t id, gboolean success)
{
- gchar *path = g_strdup_printf("/transfer%u", id);
+ char *path = g_strdup_printf("/transfer%u", id);
g_dbus_emit_signal(connection, OPENOBEX_MANAGER_PATH,
OPENOBEX_MANAGER_INTERFACE, "TransferCompleted",
g_free(path);
}
-static void emit_transfer_progress(guint32 id, guint32 total, guint32 transfered)
+static void emit_transfer_progress(uint32_t id, uint32_t total,
+ uint32_t transfered)
{
- gchar *path = g_strdup_printf("/transfer%u", id);
+ char *path = g_strdup_printf("/transfer%u", id);
g_dbus_emit_signal(connection, path,
TRANSFER_INTERFACE, "Progress",
void manager_register_transfer(struct obex_session *os)
{
- gchar *path = g_strdup_printf("/transfer%u", os->cid);
+ char *path = g_strdup_printf("/transfer%u", os->cid);
if (!g_dbus_register_interface(connection, path,
TRANSFER_INTERFACE,
void manager_unregister_transfer(struct obex_session *os)
{
- gchar *path = g_strdup_printf("/transfer%u", os->cid);
+ char *path = g_strdup_printf("/transfer%u", os->cid);
/* Got an error during a transfer. */
if (os->object)
g_dbus_send_message(connection, msg);
}
-static void agent_reply(DBusPendingCall *call, gpointer user_data)
+static void agent_reply(DBusPendingCall *call, void *user_data)
{
DBusMessage *reply = dbus_pending_call_steal_reply(call);
- const gchar *name;
+ const char *name;
DBusError derr;
gboolean *got_reply = user_data;
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID)) {
/* Splits folder and name */
- const gchar *slash = strrchr(name, '/');
+ const char *slash = strrchr(name, '/');
debug("Agent replied with %s", name);
if (!slash) {
agent->new_name = g_strdup(name);
dbus_message_unref(reply);
}
-static gboolean auth_error(GIOChannel *io, GIOCondition cond,
- gpointer user_data)
+static gboolean auth_error(GIOChannel *io, GIOCondition cond, void *user_data)
{
agent->auth_pending = FALSE;
return FALSE;
}
-int manager_request_authorization(struct obex_session *os, gint32 time,
- gchar **new_folder, gchar **new_name)
+int manager_request_authorization(struct obex_session *os, int32_t time,
+ char **new_folder, char **new_name)
{
DBusMessage *msg;
DBusPendingCall *call;
GIOChannel *io;
struct sockaddr_rc addr;
socklen_t addrlen;
- gchar address[18];
- const gchar *bda = address;
- const gchar *filename = (os->name ? os->name : "");
- const gchar *type = (os->type ? os->type : "");
- gchar *path;
- guint watch, fd;
+ char address[18];
+ const char *bda = address;
+ const char *filename = os->name ? os->name : "";
+ const char *type = os->type ? os->type : "";
+ char *path;
+ unsigned int watch, fd;
gboolean got_reply;
if (!agent)
g_free(pending);
}
-static void service_reply(DBusPendingCall *call, gpointer user_data)
+static void service_reply(DBusPendingCall *call, void *user_data)
{
struct pending_request *pending = user_data;
GIOChannel *io = pending->io;
}
static gboolean service_error(GIOChannel *io, GIOCondition cond,
- gpointer user_data)
+ void *user_data)
{
struct pending_request *pending = user_data;
return FALSE;
}
-static void find_adapter_reply(DBusPendingCall *call, gpointer user_data)
+static void find_adapter_reply(DBusPendingCall *call, void *user_data)
{
struct pending_request *pending = user_data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
pending_request_free(pending);
}
-gint request_service_authorization(struct server *server, GIOChannel *io,
+int request_service_authorization(struct server *server, GIOChannel *io,
const char *address)
{
struct pending_request *pending;
void manager_register_session(struct obex_session *os)
{
- gchar *path = g_strdup_printf("/session%u", os->cid);
+ char *path = g_strdup_printf("/session%u", os->cid);
if (!g_dbus_register_interface(connection, path,
SESSION_INTERFACE,
void manager_unregister_session(struct obex_session *os)
{
- gchar *path = g_strdup_printf("/session%u", os->cid);
+ char *path = g_strdup_printf("/session%u", os->cid);
g_dbus_emit_signal(connection, OPENOBEX_MANAGER_PATH,
OPENOBEX_MANAGER_INTERFACE, "SessionRemoved",
diff --git a/obexd/src/mimetype.c b/obexd/src/mimetype.c
index 4ec7665..0f638a0 100644
--- a/obexd/src/mimetype.c
+++ b/obexd/src/mimetype.c
static GSList *watches = NULL;
struct io_watch {
- gpointer object;
+ void *object;
obex_object_io_func func;
- gpointer user_data;
+ void *user_data;
};
-void obex_object_set_io_flags(gpointer object, int flags, int err)
+void obex_object_set_io_flags(void *object, int flags, int err)
{
GSList *l;
}
}
-static struct io_watch *find_io_watch(gpointer object)
+static struct io_watch *find_io_watch(void *object)
{
GSList *l;
return NULL;
}
-static void reset_io_watch(gpointer object)
+static void reset_io_watch(void *object)
{
struct io_watch *watch;
g_free(watch);
}
-static int set_io_watch(gpointer object, obex_object_io_func func,
- gpointer user_data)
+static int set_io_watch(void *object, obex_object_io_func func,
+ void *user_data)
{
struct io_watch *watch;
return 0;
}
-struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target,
- const char *mimetype, const guint8 *who, guint who_size)
+struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+ const char *mimetype, const uint8_t *who,
+ unsigned int who_size)
{
GSList *l;
diff --git a/obexd/src/mimetype.h b/obexd/src/mimetype.h
index 39ad51e..4cb3156 100644
--- a/obexd/src/mimetype.h
+++ b/obexd/src/mimetype.h
*
*/
-typedef gboolean (*obex_object_io_func) (gpointer object, int flags, int err,
- gpointer user_data);
+typedef gboolean (*obex_object_io_func) (void *object, int flags, int err,
+ void *user_data);
struct obex_mime_type_driver {
- const guint8 *target;
+ const uint8_t *target;
const char *mimetype;
- const guint8 *who;
- guint who_size;
- gpointer (*open) (const char *name, int oflag, mode_t mode,
- gpointer driver_data, size_t *size, int *err);
- int (*close) (gpointer object);
- ssize_t (*read) (gpointer object, void *buf, size_t count, guint8 *hi);
- ssize_t (*write) (gpointer object, const void *buf, size_t count);
+ const uint8_t *who;
+ unsigned int who_size;
+ void *(*open) (const char *name, int oflag, mode_t mode,
+ void *driver_data, size_t *size, int *err);
+ int (*close) (void *object);
+ ssize_t (*read) (void *object, void *buf, size_t count, uint8_t *hi);
+ ssize_t (*write) (void *object, const void *buf, size_t count);
int (*remove) (const char *name);
- int (*set_io_watch) (gpointer object, obex_object_io_func func,
- gpointer user_data);
+ int (*set_io_watch) (void *object, obex_object_io_func func,
+ void *user_data);
};
int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);
-struct obex_mime_type_driver *obex_mime_type_driver_find(const guint8 *target,
- const char *mimetype, const guint8 *who, guint who_size);
+struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+ const char *mimetype, const uint8_t *who,
+ unsigned int who_size);
-void obex_object_set_io_flags(gpointer object, int flags, int err);
+void obex_object_set_io_flags(void *object, int flags, int err);
diff --git a/obexd/src/obex-priv.h b/obexd/src/obex-priv.h
index 11d524f..0f167ce 100644
--- a/obexd/src/obex-priv.h
+++ b/obexd/src/obex-priv.h
*/
struct server {
- gboolean auto_accept;
- gchar *folder;
- gboolean symlinks;
- gchar *capability;
- guint32 handle;
- gchar *devnode;
- gboolean secure;
- GIOChannel *io;
- guint watch;
- guint16 tx_mtu;
- guint16 rx_mtu;
- GSList *drivers;
+ gboolean auto_accept;
+ char *folder;
+ gboolean symlinks;
+ char *capability;
+ uint32_t handle;
+ char *devnode;
+ gboolean secure;
+ GIOChannel *io;
+ unsigned int watch;
+ uint16_t tx_mtu;
+ uint16_t rx_mtu;
+ GSList *drivers;
};
struct obex_session {
- GIOChannel *io;
- guint32 cid;
- guint16 tx_mtu;
- guint16 rx_mtu;
- guint8 cmd;
- gchar *name;
- gchar *type;
- const gchar *path;
- time_t time;
- guint8 *buf;
- gint32 pending;
- gint32 offset;
- gint32 size;
- gpointer object;
- gboolean aborted;
+ GIOChannel *io;
+ uint32_t cid;
+ uint16_t tx_mtu;
+ uint16_t rx_mtu;
+ uint8_t cmd;
+ char *name;
+ char *type;
+ const char *path;
+ time_t time;
+ uint8_t *buf;
+ int32_t pending;
+ int32_t offset;
+ int32_t size;
+ void *object;
+ gboolean aborted;
struct obex_service_driver *service;
- gpointer service_data;
+ void *service_data;
struct server *server;
- gboolean checked;
- obex_t *obex;
- obex_object_t *obj;
+ gboolean checked;
+ obex_t *obex;
+ obex_object_t *obj;
struct obex_mime_type_driver *driver;
- gboolean finished;
+ gboolean finished;
};
-gint obex_session_start(GIOChannel *io, struct server *server);
+int obex_session_start(GIOChannel *io, struct server *server);
void server_free(struct server *server);
void register_record(struct server *server);
-gint request_service_authorization(struct server *server, GIOChannel *io,
- const char *address);
+int request_service_authorization(struct server *server, GIOChannel *io,
+ const char *address);
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index e4872c1..f781ce6 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
#define DEFAULT_TX_MTU 32767
/* Connection ID */
-static guint32 cid = 0x0000;
+static uint32_t cid = 0x0000;
static GSList *sessions = NULL;
typedef struct {
- guint8 version;
- guint8 flags;
- guint16 mtu;
+ uint8_t version;
+ uint8_t flags;
+ uint16_t mtu;
} __attribute__ ((packed)) obex_connect_hdr_t;
static void os_set_response(obex_object_t *obj, int err)
{
- guint8 rsp;
- guint8 lastrsp;
+ uint8_t rsp;
+ uint8_t lastrsp;
switch (err) {
case 0:
}
/* From Imendio's GnomeVFS OBEX module (om-utils.c) */
-static time_t parse_iso8610(const gchar *val, int size)
+static time_t parse_iso8610(const char *val, int size)
{
time_t time, tz_offset = 0;
struct tm tm;
- gchar *date;
- gchar tz;
+ char *date;
+ char tz;
int nr;
memset(&tm, 0, sizeof(tm));
obex_connect_hdr_t *nonhdr;
obex_headerdata_t hd;
uint8_t *buffer;
- guint hlen, newsize;
- guint16 mtu;
- guint8 hi;
- const guint8 *target = NULL, *who = NULL;
- guint target_size = 0, who_size = 0;
+ unsigned int hlen, newsize;
+ uint16_t mtu;
+ uint8_t hi;
+ const uint8_t *target = NULL, *who = NULL;
+ unsigned int target_size = 0, who_size = 0;
int err;
if (OBEX_ObjectGetNonHdrData(obj, &buffer) != sizeof(*nonhdr)) {
os_set_response(obj, err);
}
-static gboolean chk_cid(obex_t *obex, obex_object_t *obj, guint32 cid)
+static gboolean chk_cid(obex_t *obex, obex_object_t *obj, uint32_t cid)
{
struct obex_session *os;
obex_headerdata_t hd;
- guint hlen;
- guint8 hi;
+ unsigned int hlen;
+ uint8_t hi;
gboolean ret = FALSE;
os = OBEX_GetUserData(obex);
return ret;
}
-static gint obex_read_stream(struct obex_session *os, obex_t *obex,
+static int obex_read_stream(struct obex_session *os, obex_t *obex,
obex_object_t *obj)
{
- gint size;
- gint32 len = 0;
- const guint8 *buffer;
+ int size;
+ int32_t len = 0;
+ const uint8_t *buffer;
if (os->aborted)
return -EPERM;
write:
while (os->pending > 0) {
- gint w;
+ int w;
w = os->driver->write(os->object, os->buf + len,
os->pending);
return 0;
}
-static gint obex_write_stream(struct obex_session *os,
+static int obex_write_stream(struct obex_session *os,
obex_t *obex, obex_object_t *obj)
{
obex_headerdata_t hd;
- guint8 *ptr;
- gint32 len;
- guint flags;
- guint8 hi;
+ uint8_t *ptr;
+ int32_t len;
+ unsigned int flags;
+ uint8_t hi;
debug("obex_write_stream: name=%s type=%s tx_mtu=%d file=%p",
os->name ? os->name : "", os->type ? os->type : "",
switch (hi) {
case OBEX_HDR_BODY:
- flags = (len ? OBEX_FL_STREAM_DATA : OBEX_FL_STREAM_DATAEND);
+ flags = len ? OBEX_FL_STREAM_DATA : OBEX_FL_STREAM_DATAEND;
break;
case OBEX_HDR_APPARAM:
flags = 0;
return len;
}
-static gboolean handle_async_io(gpointer object, int flags, int err,
- gpointer user_data)
+static gboolean handle_async_io(void *object, int flags, int err,
+ void *user_data)
{
struct obex_session *os = user_data;
int ret = 0;
{
obex_headerdata_t hd;
gboolean stream;
- guint hlen;
- guint8 hi;
+ unsigned int hlen;
+ uint8_t hi;
int err;
if (!os->service) {
if (hlen == 0)
continue;
- os->name = g_convert((const gchar *) hd.bs, hlen,
+ os->name = g_convert((const char *) hd.bs, hlen,
"UTF8", "UTF16BE", NULL, NULL, NULL);
debug("OBEX_HDR_NAME: %s", os->name);
break;
if (hd.bs[hlen - 1] != '\0')
break;
- if (!g_utf8_validate((const gchar *) hd.bs, -1, NULL)) {
+ if (!g_utf8_validate((const char *) hd.bs, -1, NULL)) {
debug("Invalid type header: %s", hd.bs);
break;
}
/* FIXME: x-obex/folder-listing - type is mandatory */
- os->type = g_strndup((const gchar *) hd.bs, hlen);
+ os->type = g_strndup((const char *) hd.bs, hlen);
debug("OBEX_HDR_TYPE: %s", os->type);
os->driver = obex_mime_type_driver_find(
os->service->target, os->type,
obex_t *obex, obex_object_t *obj)
{
obex_headerdata_t hd;
- guint32 hlen;
+ uint32_t hlen;
int err;
- guint8 hi;
+ uint8_t hi;
if (!os->service) {
OBEX_ObjectSetRsp(obj, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN);
break;
}
- os->name = g_convert((const gchar *) hd.bs, hlen,
+ os->name = g_convert((const char *) hd.bs, hlen,
"UTF8", "UTF16BE", NULL, NULL, NULL);
debug("Set path name: %s", os->name);
os_set_response(obj, err);
}
-int obex_get_stream_start(struct obex_session *os, const gchar *filename)
+int obex_get_stream_start(struct obex_session *os, const char *filename)
{
- gint err;
- gpointer object;
+ int err;
+ void *object;
size_t size;
object = os->driver->open(filename, O_RDONLY, 0, os->service_data,
return err;
}
-gint obex_put_stream_start(struct obex_session *os, const gchar *filename)
+int obex_put_stream_start(struct obex_session *os, const char *filename)
{
int err;
{
struct obex_session *os;
obex_headerdata_t hd;
- guint hlen;
- guint8 hi;
- gint ret;
+ unsigned int hlen;
+ uint8_t hi;
+ int ret;
os = OBEX_GetUserData(obex);
if (hlen == 0)
continue;
- os->name = g_convert((const gchar *) hd.bs, hlen,
+ os->name = g_convert((const char *) hd.bs, hlen,
"UTF8", "UTF16BE", NULL, NULL, NULL);
debug("OBEX_HDR_NAME: %s", os->name);
break;
if (hd.bs[hlen - 1] != '\0')
break;
- if (!g_utf8_validate((const gchar *) hd.bs, -1, NULL)) {
+ if (!g_utf8_validate((const char *) hd.bs, -1, NULL)) {
debug("Invalid type header: %s", hd.bs);
break;
}
- os->type = g_strndup((const gchar *) hd.bs, hlen);
+ os->type = g_strndup((const char *) hd.bs, hlen);
debug("OBEX_HDR_TYPE: %s", os->type);
os->driver = obex_mime_type_driver_find(
os->service->target, os->type,
debug("OBEX_HDR_LENGTH: %d", os->size);
break;
case OBEX_HDR_TIME:
- os->time = parse_iso8610((const gchar *) hd.bs, hlen);
+ os->time = parse_iso8610((const char *) hd.bs, hlen);
break;
}
}
os_set_response(obj, err);
}
-static void obex_event(obex_t *obex, obex_object_t *obj, gint mode,
- gint evt, gint cmd, gint rsp)
+static void obex_event(obex_t *obex, obex_object_t *obj, int mode,
+ int evt, int cmd, int rsp)
{
struct obex_session *os;
g_free(server);
}
-static void obex_handle_destroy(gpointer user_data)
+static void obex_handle_destroy(void *user_data)
{
struct obex_session *os;
obex_t *obex = user_data;
OBEX_Cleanup(obex);
}
-static gboolean tty_reinit(gpointer data)
+static gboolean tty_reinit(void *data)
{
struct server *server = data;
GSList *l;
- guint services = 0;
+ unsigned int services = 0;
for (l = server->drivers; l; l = l->next) {
struct obex_service_driver *driver = l->data;
}
static gboolean obex_handle_input(GIOChannel *io,
- GIOCondition cond, gpointer user_data)
+ GIOCondition cond, void *user_data)
{
obex_t *obex = user_data;
struct obex_session *os = OBEX_GetUserData(obex);
return FALSE;
}
-void obex_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+void obex_connect_cb(GIOChannel *io, GError *err, void *user_data)
{
struct server *server = user_data;
g_io_channel_shutdown(io, TRUE, NULL);
}
-gint obex_session_start(GIOChannel *io, struct server *server)
+int obex_session_start(GIOChannel *io, struct server *server)
{
struct obex_session *os;
obex_t *obex;
- gint ret, fd;
+ int ret, fd;
os = g_new0(struct obex_session, 1);
return 0;
}
-gint obex_tty_session_stop(void)
+int obex_tty_session_stop(void)
{
GSList *l;
return os->server->folder;
}
-guint16 obex_get_service(struct obex_session *os)
+uint16_t obex_get_service(struct obex_session *os)
{
return os->service->service;
}
char *obex_get_id(struct obex_session *os)
{
GError *gerr = NULL;
- gchar address[18];
- guint8 channel;
+ char address[18];
+ uint8_t channel;
bt_io_get(os->io, BT_IO_RFCOMM, &gerr,
BT_IO_OPT_DEST, address,
}
ssize_t obex_aparam_read(struct obex_session *os,
- obex_object_t *obj, const guint8 **buffer)
+ obex_object_t *obj, const uint8_t **buffer)
{
obex_headerdata_t hd;
- guint8 hi;
- guint32 hlen;
+ uint8_t hi;
+ uint32_t hlen;
OBEX_ObjectReParseHeaders(os->obex, obj);
}
int obex_aparam_write(struct obex_session *os,
- obex_object_t *obj, const guint8 *data, guint size)
+ obex_object_t *obj, const uint8_t *data, unsigned int size)
{
obex_headerdata_t hd;
diff --git a/obexd/src/obex.h b/obexd/src/obex.h
index 5b92808..1d56809 100644
--- a/obexd/src/obex.h
+++ b/obexd/src/obex.h
struct obex_session;
-void obex_connect_cb(GIOChannel *io, GError *err, gpointer user_data);
+void obex_connect_cb(GIOChannel *io, GError *err, void *user_data);
-int obex_get_stream_start(struct obex_session *os, const gchar *filename);
-int obex_put_stream_start(struct obex_session *os, const gchar *filename);
+int obex_get_stream_start(struct obex_session *os, const char *filename);
+int obex_put_stream_start(struct obex_session *os, const char *filename);
const char *obex_get_name(struct obex_session *os);
ssize_t obex_get_size(struct obex_session *os);
const char *obex_get_type(struct obex_session *os);
const char *obex_get_root_folder(struct obex_session *os);
-guint16 obex_get_service(struct obex_session *os);
+uint16_t obex_get_service(struct obex_session *os);
gboolean obex_get_symlinks(struct obex_session *os);
const char *obex_get_capability_path(struct obex_session *os);
gboolean obex_get_auto_accept(struct obex_session *os);
int obex_remove(struct obex_session *os, const char *path);
char *obex_get_id(struct obex_session *os);
-ssize_t obex_aparam_read(struct obex_session *os,
- obex_object_t *obj, const guint8 **buffer);
-int obex_aparam_write(struct obex_session *os,
- obex_object_t *obj, const guint8 *buffer, guint size);
+ssize_t obex_aparam_read(struct obex_session *os, obex_object_t *obj,
+ const uint8_t **buffer);
+int obex_aparam_write(struct obex_session *os, obex_object_t *obj,
+ const uint8_t *buffer, unsigned int size);
-const gchar *obex_option_root_folder(void);
+const char *obex_option_root_folder(void);
gboolean obex_option_symlinks(void);
-int tty_init(gint service, const gchar *folder, const gchar *capability,
- gboolean symlinks, const gchar *devnode);
-gint obex_tty_session_stop(void);
+int tty_init(int service, const char *folder, const char *capability,
+ gboolean symlinks, const char *devnode);
+int obex_tty_session_stop(void);
void tty_closed(void);
/* Just a thin wrapper around memcmp to deal with NULL values */
diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c
index 301f64e..2e12ac3 100644
--- a/obexd/src/plugin.c
+++ b/obexd/src/plugin.c
gboolean plugin_init(void)
{
GDir *dir;
- const gchar *file;
+ const char *file;
unsigned int i;
if (strlen(PLUGINDIR) == 0)
while ((file = g_dir_read_name(dir)) != NULL) {
struct obex_plugin_desc *desc;
void *handle;
- gchar *filename;
+ char *filename;
if (g_str_has_prefix(file, "lib") == TRUE ||
g_str_has_suffix(file, ".so") == FALSE)
diff --git a/obexd/src/service.c b/obexd/src/service.c
index ad0889d..befea9c 100644
--- a/obexd/src/service.c
+++ b/obexd/src/service.c
static GSList *drivers = NULL;
-struct obex_service_driver *obex_service_driver_find(GSList *list,
- const guint8 *target, guint target_size,
- const guint8 *who, guint who_size)
-
+struct obex_service_driver *obex_service_driver_find(GSList *drivers,
+ const uint8_t *target, unsigned int target_size,
+ const uint8_t *who, unsigned int who_size)
{
GSList *l;
- for (l = list; l; l = l->next) {
+ for (l = drivers; l; l = l->next) {
struct obex_service_driver *driver = l->data;
if (memcmp0(who, driver->who, who_size))
return NULL;
}
-GSList *obex_service_driver_list(guint16 services)
+GSList *obex_service_driver_list(uint16_t services)
{
GSList *l;
GSList *list = NULL;
diff --git a/obexd/src/service.h b/obexd/src/service.h
index 81185d9..1726c43 100644
--- a/obexd/src/service.h
+++ b/obexd/src/service.h
struct obex_service_driver {
const char *name;
- guint16 service;
- guint8 channel;
- const guint8 *target;
- guint target_size;
- const guint8 *who;
- guint who_size;
- const gchar *record;
- gpointer (*connect) (struct obex_session *os, int *err);
- void (*progress) (struct obex_session *os, gpointer user_data);
+ uint16_t service;
+ uint8_t channel;
+ const uint8_t *target;
+ unsigned int target_size;
+ const uint8_t *who;
+ unsigned int who_size;
+ const char *record;
+ void *(*connect) (struct obex_session *os, int *err);
+ void (*progress) (struct obex_session *os, void *user_data);
int (*get) (struct obex_session *os, obex_object_t *obj,
- gboolean *stream, gpointer user_data);
- int (*put) (struct obex_session *os, gpointer user_data);
- gint (*chkput) (struct obex_session *os, gpointer user_data);
- int (*setpath) (struct obex_session *os, obex_object_t *obj, gpointer user_data);
- void (*disconnect) (struct obex_session *os, gpointer user_data);
- void (*reset) (struct obex_session *os, gpointer user_data);
+ gboolean *stream, void *user_data);
+ int (*put) (struct obex_session *os, void *user_data);
+ int (*chkput) (struct obex_session *os, void *user_data);
+ int (*setpath) (struct obex_session *os, obex_object_t *obj,
+ void *user_data);
+ void (*disconnect) (struct obex_session *os, void *user_data);
+ void (*reset) (struct obex_session *os, void *user_data);
};
int obex_service_driver_register(struct obex_service_driver *driver);
void obex_service_driver_unregister(struct obex_service_driver *driver);
-GSList *obex_service_driver_list(guint16 services);
+GSList *obex_service_driver_list(uint16_t services);
struct obex_service_driver *obex_service_driver_find(GSList *drivers,
- const guint8 *target, guint target_size,
- const guint8 *who, guint who_size);
+ const uint8_t *target, unsigned int target_size,
+ const uint8_t *who, unsigned int who_size);