| 101 |
101 |
| 102 /* |
102 /* |
| 103 * Offer File chunk (6). |
103 * Offer File chunk (6). |
| 104 */ |
104 */ |
| 105 struct offerfile_chunk { |
105 struct offerfile_chunk { |
| 106 char fileid[MXIT_CHUNK_FILEID_LEN]; |
106 char fileid[MXIT_CHUNK_FILEID_LEN]; |
| 107 char username[MXIT_CP_MAX_JID_LEN + 1]; |
107 char username[MXIT_CP_MAX_JID_LEN + 1]; |
| 108 int filesize; |
108 unsigned int filesize; |
| 109 char filename[FILENAME_MAX]; |
109 char filename[FILENAME_MAX]; |
| 110 char mimetype[64]; |
110 char mimetype[64]; |
| 111 }; |
111 }; |
| 112 |
112 |
| 113 /* |
113 /* |
| 114 * Get File chunk (8) response. |
114 * Get File chunk (8) response. |
| 115 */ |
115 */ |
| 116 struct getfile_chunk { |
116 struct getfile_chunk { |
| 117 char fileid[MXIT_CHUNK_FILEID_LEN]; |
117 char fileid[MXIT_CHUNK_FILEID_LEN]; |
| 118 int offset; |
118 unsigned int offset; |
| 119 int length; |
119 unsigned int length; |
| 120 int crc; |
120 unsigned int crc; |
| 121 char* data; |
121 char* data; |
| 122 }; |
122 }; |
| 123 |
123 |
| 124 /* |
124 /* |
| 125 * Custom Resource chunk (1). |
125 * Custom Resource chunk (1). |
| 126 */ |
126 */ |
| 151 |
151 |
| 152 /* |
152 /* |
| 153 * Get Avatar chunk (14) response. |
153 * Get Avatar chunk (14) response. |
| 154 */ |
154 */ |
| 155 struct getavatar_chunk { |
155 struct getavatar_chunk { |
| 156 char mxitid[50]; |
156 char mxitid[50]; |
| 157 char avatarid[64]; |
157 char avatarid[64]; |
| 158 char format[16]; |
158 char format[16]; |
| 159 char bitdepth; |
159 char bitdepth; |
| 160 int crc; |
160 unsigned int crc; |
| 161 int width; |
161 unsigned int width; |
| 162 int height; |
162 unsigned int height; |
| 163 int length; |
163 unsigned int length; |
| 164 char* data; |
164 char* data; |
| 165 }; |
165 }; |
| 166 |
166 |
| 167 /* |
167 /* |
| 168 * Send File Direct chunk (10) response. |
168 * Send File Direct chunk (10) response. |
| 169 */ |
169 */ |
| 170 struct sendfile_chunk { |
170 struct sendfile_chunk { |
| 171 char username[MXIT_CP_MAX_JID_LEN + 1]; |
171 char username[MXIT_CP_MAX_JID_LEN + 1]; |
| 172 int status; |
172 unsigned int status; |
| 173 char statusmsg[1024]; |
173 char statusmsg[1024]; |
| 174 }; |
174 }; |
| 175 |
175 |
| 176 /* Encode chunk */ |
176 /* Encode chunk */ |
| 177 int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ); |
177 size_t mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, size_t datalen ); |
| 178 int mxit_chunk_create_reject( char* chunkdata, const char* fileid ); |
178 size_t mxit_chunk_create_reject( char* chunkdata, const char* fileid ); |
| 179 int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset ); |
179 size_t mxit_chunk_create_get( char* chunkdata, const char* fileid, size_t filesize, size_t offset ); |
| 180 int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ); |
180 size_t mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ); |
| 181 int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen ); |
181 size_t mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, size_t datalen ); |
| 182 int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId ); |
182 size_t mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId ); |
| 183 |
183 |
| 184 /* Decode chunk */ |
184 /* Decode chunk */ |
| 185 void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ); |
185 void mxit_chunk_parse_offer( char* chunkdata, size_t datalen, struct offerfile_chunk* offer ); |
| 186 void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ); |
186 void mxit_chunk_parse_get( char* chunkdata, size_t datalen, struct getfile_chunk* getfile ); |
| 187 void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ); |
187 void mxit_chunk_parse_cr( char* chunkdata, size_t datalen, struct cr_chunk* cr ); |
| 188 void mxit_chunk_parse_sendfile( char* chunkdata, int datalen, struct sendfile_chunk* sendfile ); |
188 void mxit_chunk_parse_sendfile( char* chunkdata, size_t datalen, struct sendfile_chunk* sendfile ); |
| 189 void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ); |
189 void mxit_chunk_parse_get_avatar( char* chunkdata, size_t datalen, struct getavatar_chunk* avatar ); |
| 190 |
190 |
| 191 #endif /* _MXIT_CHUNK_H_ */ |
191 #endif /* _MXIT_CHUNK_H_ */ |
| 192 |
192 |