Tizen 2.1 base
[platform/upstream/hplip.git] / scan / sane / http.h
1 /************************************************************************************\
2
3   http.h - HTTP/1.1 feeder and consumer
4
5   (c) 2008 Copyright Hewlett-Packard Development Company, LP
6
7   Permission is hereby granted, free of charge, to any person obtaining a copy 
8   of this software and associated documentation files (the "Software"), to deal 
9   in the Software without restriction, including without limitation the rights 
10   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
11   of the Software, and to permit persons to whom the Software is furnished to do 
12   so, subject to the following conditions:
13
14   The above copyright notice and this permission notice shall be included in all
15   copies or substantial portions of the Software.
16
17   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
18   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 
19   FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
20   COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
21   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
22   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24   Primary Author: Naga Samrat Chowdary, Narla
25   Contributing Author: Sarbeswar Meher
26 \************************************************************************************/
27
28 #ifndef _HTTP_H
29 #define _HTTP_H
30
31 enum HTTP_RESULT
32 {
33    HTTP_R_OK = 0,
34    HTTP_R_IO_ERROR,
35    HTTP_R_EOF,
36    HTTP_R_IO_TIMEOUT,
37    HTTP_R_MALLOC_ERROR,
38    HTTP_R_INVALID_BUF_SIZE,
39 };
40
41 # define ZERO_FOOTER "\r\n0\r\n\r\n"
42
43 typedef void * HTTP_HANDLE;
44
45 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_open(HPMUD_DEVICE dd, const char *hpmud_channel, HTTP_HANDLE *handle);
46 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_close(HTTP_HANDLE handle);
47 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_read_header(HTTP_HANDLE handle, void *data, int max_size, int sec_timout, int *bytes_read);
48 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_read_payload(HTTP_HANDLE handle, void *data, int max_size, int sec_timout, int *bytes_read);
49 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_read(HTTP_HANDLE handle, void *data, int max_size, int sec_timout, int *bytes_read);
50 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_read_size(HTTP_HANDLE handle, void *data, int max_size, int sec_timout, int *bytes_read);
51 enum HTTP_RESULT __attribute__ ((visibility ("hidden"))) http_write(HTTP_HANDLE handle, void *data, int data_size, int sec_timout);
52 void __attribute__ ((visibility ("hidden"))) http_unchunk_data(char *buffer);
53 #endif  // _HTTP_H
54
55