1 #ifndef __SENDF_H
2 #define __SENDF_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  * $Id: sendf.h,v 1.46 2008-09-29 11:13:37 bagder Exp $
24  ***************************************************************************/
25 
26 #include "setup.h"
27 
28 CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *,
29                     const char *fmt, ...);
30 void Curl_infof(struct SessionHandle *, const char *fmt, ...);
31 void Curl_failf(struct SessionHandle *, const char *fmt, ...);
32 
33 #if defined(CURL_DISABLE_VERBOSE_STRINGS)
34 
35 #if defined(HAVE_VARIADIC_MACROS_C99)
36 #define infof(...)  do { } while (0)
37 #elif defined(HAVE_VARIADIC_MACROS_GCC)
38 #define infof(x...)  do { } while (0)
39 #else
40 #define infof (void)
41 #endif
42 
43 #else /* CURL_DISABLE_VERBOSE_STRINGS */
44 
45 #define infof Curl_infof
46 
47 #endif /* CURL_DISABLE_VERBOSE_STRINGS */
48 
49 #define failf Curl_failf
50 
51 #define CLIENTWRITE_BODY   1
52 #define CLIENTWRITE_HEADER 2
53 #define CLIENTWRITE_BOTH   (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
54 
55 CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr,
56                            size_t len);
57 
58 void Curl_read_rewind(struct connectdata *conn,
59                       size_t extraBytesRead);
60 
61 /* internal read-function, does plain socket only */
62 int Curl_read_plain(curl_socket_t sockfd,
63                     char *buf,
64                     size_t bytesfromsocket,
65                     ssize_t *n);
66 
67 /* internal read-function, does plain socket, SSL and krb4 */
68 int Curl_read(struct connectdata *conn, curl_socket_t sockfd,
69               char *buf, size_t buffersize,
70               ssize_t *n);
71 /* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */
72 CURLcode Curl_write(struct connectdata *conn,
73                     curl_socket_t sockfd,
74                     const void *mem, size_t len,
75                     ssize_t *written);
76 
77 /* internal write-function, does plain sockets ONLY */
78 CURLcode Curl_write_plain(struct connectdata *conn,
79                           curl_socket_t sockfd,
80                           const void *mem, size_t len,
81                           ssize_t *written);
82 
83 /* the function used to output verbose information */
84 int Curl_debug(struct SessionHandle *handle, curl_infotype type,
85                char *data, size_t size,
86                struct connectdata *conn);
87 
88 
89 #endif /* __SENDF_H */
90