libpurple/protocols/mxit/chunk.h

Tue, 18 Dec 2012 15:57:47 +0200

author
Andrew Victor <andrew.victor@mxit.com>
date
Tue, 18 Dec 2012 15:57:47 +0200
branch
mxit-2.x.y
changeset 33556
1fe2f250ff9e
parent 31722
9e4e8315893d
child 35680
965839bfe169
child 37822
06278419c703
permissions
-rw-r--r--

Update with changes in release-2.x.y

28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
2 * MXit Protocol libPurple Plugin
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * -- handle chunked data (multimedia messages) --
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * Pieter Loubser <libpurple@mxit.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
8 * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
9 * <http://www.mxitlifestyle.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
14 * (at your option) any later version.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
19 * GNU General Public License for more details.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
24 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
25
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
26 #ifndef _MXIT_CHUNK_H_
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
27 #define _MXIT_CHUNK_H_
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
28
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
29
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
30 #include "roster.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
31
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
32
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
33 #define MXIT_CHUNK_FILEID_LEN 8 /* bytes */
28988
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
34 #define MXIT_CHUNK_HEADER_SIZE 5 /* type (1 byte) + length (4 bytes) */
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
35
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
36
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
37 /* Multimedia chunk types */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
38 #define CP_CHUNK_NONE 0x00 /* (0) no chunk */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 #define CP_CHUNK_CUSTOM 0x01 /* (1) custom resource */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
40 #define CP_CHUNK_SPLASH 0x02 /* (2) splash image */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41 #define CP_CHUNK_CLICK 0x03 /* (3) splash click through */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42 #define CP_CHUNK_OFFER 0x06 /* (6) offer file */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 #define CP_CHUNK_REJECT 0x07 /* (7) reject file */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
44 #define CP_CHUNK_GET 0x08 /* (8) get file */
30270
8380aae8b132 I before E, except after C
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 28988
diff changeset
45 #define CP_CHUNK_RECEIVED 0x09 /* (9) received file */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46 #define CP_CHUNK_DIRECT_SND 0x0A /* (10) send file direct */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
47 #define CP_CHUNK_DIRECT_FWD 0x0B /* (11) forward file direct */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48 #define CP_CHUNK_SKIN 0x0C /* (12) MXit client skin */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
49 #define CP_CHUNK_SET_AVATAR 0x0D /* (13) set avatar */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
50 #define CP_CHUNK_GET_AVATAR 0x0E /* (14) get avatar */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
51 #define CP_CHUNK_END 0x7E /* (126) end */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
52 #define CP_CHUNK_EXT 0x7F /* (127) extended type */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
53
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
55 /* Custom Resource operations */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
56 #define CR_OP_UPDATE 0
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
57 #define CR_OP_REMOVE 1
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
58
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
59 /* File Received status */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
60 #define RECV_STATUS_SUCCESS 0
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
61 #define RECV_STATUS_PARSE_FAIL 1
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
62 #define RECV_STATUS_CANNOT_OPEN 8
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
63 #define RECV_STATUS_BAD_CRC 9
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
64 #define RECV_STATUS_BAD_ID 10
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
65
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66 /* File Reject status */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 #define REJECT_BY_USER 1
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68 #define REJECT_FILETYPE 2
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 #define REJECT_NO_RESOURCES 3
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70 #define REJECT_BAD_RECIPIENT 4
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 /*
28988
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
73 * Chunk header manipulation functions
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74 */
28988
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
75 static inline guint chunk_type( gchar* chunkheader )
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
76 {
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
77 return *chunkheader;
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
78 }
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
79
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
80 static inline void set_chunk_type( gchar* chunkheader, guint type )
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
81 {
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
82 *chunkheader = type;
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
83 }
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
84
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
85 static inline guint32 chunk_length( gchar* chunkheader )
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
86 {
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
87 guint32 length = *( (const guint32*) &chunkheader[1] );
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
88 return htonl( length );
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
89 }
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
90
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
91 static inline void set_chunk_length( gchar* chunkheader, guint32 size )
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
92 {
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
93 size = htonl( size );
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
94 memcpy( &chunkheader[1], &size, sizeof( guint32 ) );
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
95 }
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
96
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
97 static inline gchar* chunk_data( gchar* chunkheader )
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
98 {
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
99 return &chunkheader[MXIT_CHUNK_HEADER_SIZE];
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
100 }
e59ddd6a3942 The "packed" attribute on the raw_chunk data-structure seems to be a GCC extension.
Andrew Victor <andrew.victor@mxit.com>
parents: 28841
diff changeset
101
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
102 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
103 * Offer File chunk (6).
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
104 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 struct offerfile_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106 char fileid[MXIT_CHUNK_FILEID_LEN];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
107 char username[MXIT_CP_MAX_JID_LEN + 1];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
108 int filesize;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 char filename[FILENAME_MAX];
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
110 char mimetype[64];
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
113 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
114 * Get File chunk (8) response.
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
115 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116 struct getfile_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117 char fileid[MXIT_CHUNK_FILEID_LEN];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
118 int offset;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
119 int length;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 int crc;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
121 char* data;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
122 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
124 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
125 * Custom Resource chunk (1).
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
126 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127 struct cr_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
128 char id[64];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
129 char handle[64];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
130 char operation;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
131 GList* resources;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
132 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
134 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
135 * Splash Image chunk (2)
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
136 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 struct splash_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 char anchor;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139 char showtime;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140 int bgcolor;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 char* data;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142 int datalen;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
144
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
145 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
146 * Splash Click Through chunk (3)
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
147 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148 struct splash_click_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
149 char reserved[1];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
151
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
152 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
153 * Get Avatar chunk (14) response.
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
154 */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
155 struct getavatar_chunk {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156 char mxitid[50];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
157 char avatarid[64];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
158 char format[16];
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
159 char bitdepth;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
160 int crc;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
161 int width;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
162 int height;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
163 int length;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
164 char* data;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
165 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
166
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
167 /*
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
168 * Send File Direct chunk (10) response.
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
169 */
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
170 struct sendfile_chunk {
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
171 char username[MXIT_CP_MAX_JID_LEN + 1];
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
172 int status;
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
173 char statusmsg[1024];
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
174 };
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
175
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176 /* Encode chunk */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178 int mxit_chunk_create_reject( char* chunkdata, const char* fileid );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
179 int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
181 int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen );
30788
da428f8d1f97 * removed unneeded variable passing.
Pieter Loubser <pieter.loubser@mxit.com>
parents: 30270
diff changeset
182 int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 /* Decode chunk */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr );
31722
9e4e8315893d * Handle response to SendFile chunk packet, and display the error message
Andrew Victor <andrew.victor@mxit.com>
parents: 30788
diff changeset
188 void mxit_chunk_parse_sendfile( char* chunkdata, int datalen, struct sendfile_chunk* sendfile );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189 void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
191 #endif /* _MXIT_CHUNK_H_ */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
192

mercurial