2011-06-29 04:32:53 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* 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
|
2013-02-15 22:25:24 +08:00
|
|
|
* 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.
|
2011-06-29 04:32:53 +08:00
|
|
|
*
|
|
|
|
* 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_HEADER_H
|
|
|
|
#define __GOBEX_HEADER_H
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2015-03-01 16:27:37 +08:00
|
|
|
#include "gobex/gobex-defs.h"
|
|
|
|
#include "gobex/gobex-apparam.h"
|
2011-06-29 04:32:53 +08:00
|
|
|
|
|
|
|
/* Header ID's */
|
2011-07-11 02:47:49 +08:00
|
|
|
#define G_OBEX_HDR_INVALID 0x00
|
2011-07-11 02:36:47 +08:00
|
|
|
|
2011-07-11 02:47:49 +08:00
|
|
|
#define G_OBEX_HDR_COUNT 0xc0
|
|
|
|
#define G_OBEX_HDR_NAME 0x01
|
|
|
|
#define G_OBEX_HDR_TYPE 0x42
|
|
|
|
#define G_OBEX_HDR_LENGTH 0xc3
|
|
|
|
#define G_OBEX_HDR_TIME 0x44
|
|
|
|
#define G_OBEX_HDR_DESCRIPTION 0x05
|
|
|
|
#define G_OBEX_HDR_TARGET 0x46
|
|
|
|
#define G_OBEX_HDR_HTTP 0x47
|
|
|
|
#define G_OBEX_HDR_BODY 0x48
|
|
|
|
#define G_OBEX_HDR_BODY_END 0x49
|
|
|
|
#define G_OBEX_HDR_WHO 0x4a
|
|
|
|
#define G_OBEX_HDR_CONNECTION 0xcb
|
|
|
|
#define G_OBEX_HDR_APPARAM 0x4c
|
|
|
|
#define G_OBEX_HDR_AUTHCHAL 0x4d
|
|
|
|
#define G_OBEX_HDR_AUTHRESP 0x4e
|
|
|
|
#define G_OBEX_HDR_CREATOR 0xcf
|
|
|
|
#define G_OBEX_HDR_WANUUID 0x50
|
|
|
|
#define G_OBEX_HDR_OBJECTCLASS 0x51
|
|
|
|
#define G_OBEX_HDR_SESSIONPARAM 0x52
|
|
|
|
#define G_OBEX_HDR_SESSIONSEQ 0x93
|
|
|
|
#define G_OBEX_HDR_ACTION 0x94
|
|
|
|
#define G_OBEX_HDR_DESTNAME 0x15
|
|
|
|
#define G_OBEX_HDR_PERMISSIONS 0xd6
|
|
|
|
#define G_OBEX_HDR_SRM 0x97
|
2011-12-17 18:17:46 +08:00
|
|
|
#define G_OBEX_HDR_SRMP 0x98
|
2011-06-29 04:32:53 +08:00
|
|
|
|
2011-08-30 17:30:39 +08:00
|
|
|
/* Action header values */
|
|
|
|
#define G_OBEX_ACTION_COPY 0x00
|
|
|
|
#define G_OBEX_ACTION_MOVE 0x01
|
|
|
|
#define G_OBEX_ACTION_SETPERM 0x02
|
|
|
|
|
2011-12-17 18:17:45 +08:00
|
|
|
/* SRM header values */
|
|
|
|
#define G_OBEX_SRM_DISABLE 0x00
|
|
|
|
#define G_OBEX_SRM_ENABLE 0x01
|
|
|
|
#define G_OBEX_SRM_INDICATE 0x02
|
|
|
|
|
2011-12-17 18:17:46 +08:00
|
|
|
/* SRMP header values */
|
|
|
|
#define G_OBEX_SRMP_NEXT 0x00
|
|
|
|
#define G_OBEX_SRMP_WAIT 0x01
|
|
|
|
#define G_OBEX_SRMP_NEXT_WAIT 0x02
|
|
|
|
|
2011-06-29 04:32:53 +08:00
|
|
|
typedef struct _GObexHeader GObexHeader;
|
|
|
|
|
|
|
|
gboolean g_obex_header_get_unicode(GObexHeader *header, const char **str);
|
|
|
|
gboolean g_obex_header_get_bytes(GObexHeader *header, const guint8 **val,
|
2011-06-29 16:04:12 +08:00
|
|
|
gsize *len);
|
2011-06-29 04:32:53 +08:00
|
|
|
gboolean g_obex_header_get_uint8(GObexHeader *header, guint8 *val);
|
|
|
|
gboolean g_obex_header_get_uint32(GObexHeader *header, guint32 *val);
|
2012-08-09 18:32:27 +08:00
|
|
|
GObexApparam *g_obex_header_get_apparam(GObexHeader *header);
|
2011-06-29 04:32:53 +08:00
|
|
|
|
|
|
|
GObexHeader *g_obex_header_new_unicode(guint8 id, const char *str);
|
2011-07-11 01:59:12 +08:00
|
|
|
GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len);
|
2011-06-29 04:32:53 +08:00
|
|
|
GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val);
|
|
|
|
GObexHeader *g_obex_header_new_uint32(guint8 id, guint32 val);
|
2014-03-28 00:03:58 +08:00
|
|
|
GObexHeader *g_obex_header_new_tag(guint8 id, GObexApparam *apparam);
|
2012-08-09 18:32:27 +08:00
|
|
|
GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam);
|
2011-06-29 04:32:53 +08:00
|
|
|
|
2011-07-11 02:36:47 +08:00
|
|
|
GSList *g_obex_header_create_list(guint8 first_hdr_id, va_list args,
|
|
|
|
gsize *total_len);
|
|
|
|
|
2011-06-29 04:32:53 +08:00
|
|
|
guint8 g_obex_header_get_id(GObexHeader *header);
|
|
|
|
guint16 g_obex_header_get_length(GObexHeader *header);
|
|
|
|
|
2011-07-05 17:33:57 +08:00
|
|
|
gssize g_obex_header_encode(GObexHeader *header, void *buf, gsize buf_len);
|
2011-06-29 16:04:12 +08:00
|
|
|
GObexHeader *g_obex_header_decode(const void *data, gsize len,
|
2011-06-29 18:15:05 +08:00
|
|
|
GObexDataPolicy data_policy, gsize *parsed,
|
|
|
|
GError **err);
|
2011-06-29 04:32:53 +08:00
|
|
|
void g_obex_header_free(GObexHeader *header);
|
|
|
|
|
|
|
|
#endif /* __GOBEX_HEADER_H */
|