diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-06-28 23:32:53 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:21:57 +0100 |
commit | b105277b9726903f1eea33d6b0046e832406d539 (patch) | |
tree | 2f05b9316ac456cfd955a84c81b85c1a624e42af /gobex/gobex-packet.h | |
parent | f9e824c0e6495ee16903c0033f7cd4a2c7228dea (diff) | |
download | bluez-b105277b9726903f1eea33d6b0046e832406d539.tar.gz |
gobex: Split gobex.c into multiple modules
Diffstat (limited to 'gobex/gobex-packet.h')
-rw-r--r-- | gobex/gobex-packet.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h new file mode 100644 index 000000000..ddce68607 --- /dev/null +++ b/gobex/gobex-packet.h @@ -0,0 +1,59 @@ +/* + * + * OBEX library with GLib integration + * + * Copyright (C) 2011 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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 + * + */ + +#ifndef __GOBEX_PACKET_H +#define __GOBEX_PACKET_H + +#include <unistd.h> + +#include <glib.h> + +#include <gobex/gobex-defs.h> +#include <gobex/gobex-header.h> + +/* Opcodes */ +#define G_OBEX_OP_CONNECT 0x00 +#define G_OBEX_OP_DISCONNECT 0x01 +#define G_OBEX_OP_PUT 0x02 +#define G_OBEX_OP_GET 0x03 +#define G_OBEX_OP_SETPATH 0x05 +#define G_OBEX_OP_SESSION 0x07 +#define G_OBEX_OP_ABORT 0x7f + +#define G_OBEX_PACKET_FINAL 0x80 + +typedef struct _GObexPacket GObexPacket; + +GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id); +guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final); +gboolean g_obex_packet_add_header(GObexPacket *pkt, GObexHeader *header); +gboolean g_obex_packet_set_data(GObexPacket *pkt, const void *data, size_t len, + GObexDataPolicy data_policy); +const void *g_obex_packet_get_data(GObexPacket *pkt, size_t *len); +GObexPacket *g_obex_packet_new(guint8 opcode, gboolean final); +void g_obex_packet_free(GObexPacket *pkt); + +GObexPacket *g_obex_packet_decode(const void *data, size_t len, + size_t header_offset, + GObexDataPolicy data_policy); +ssize_t g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, size_t len); + +#endif /* __GOBEX_PACKET_H */ |