tizen 2.3.1 release
[external/curl.git] / lib / pingpong.h
index cbbff8f..b925ab9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __PINGPONG_H
-#define __PINGPONG_H
+#ifndef HEADER_CURL_PINGPONG_H
+#define HEADER_CURL_PINGPONG_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -22,9 +22,7 @@
  *
  ***************************************************************************/
 
-#include <stdarg.h>
-
-#include "setup.h"
+#include "curl_setup.h"
 
 #if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_FTP) || \
   !defined(CURL_DISABLE_POP3) || !defined(CURL_DISABLE_SMTP)
 /* forward-declaration, this is defined in urldata.h */
 struct connectdata;
 
+typedef enum {
+  FTPTRANSFER_BODY, /* yes do transfer a body */
+  FTPTRANSFER_INFO, /* do still go through to get info/headers */
+  FTPTRANSFER_NONE, /* don't get anything and don't get info */
+  FTPTRANSFER_LAST  /* end of list marker, never used */
+} curl_pp_transfer;
+
 /*
  * 'pingpong' is the generic struct used for protocols doing server<->client
  * conversations in a back-and-forth style such as FTP, IMAP, POP3, SMTP etc.
@@ -66,23 +71,17 @@ struct pingpong {
 
   CURLcode (*statemach_act)(struct connectdata *conn);
 
-  int (*endofresp)(struct pingpong *pp, int *code);
+  bool (*endofresp)(struct connectdata *conn, char *ptr, size_t len,
+                    int *code);
 };
 
 /*
- * Curl_pp_multi_statemach()
- *
- * called repeatedly until done when the multi interface is used.
- */
-CURLcode Curl_pp_multi_statemach(struct pingpong *pp);
-
-/*
- * Curl_pp_easy_statemach()
+ * Curl_pp_statemach()
  *
- * called repeatedly until done when the easy interface is used.
+ * called repeatedly until done. Set 'wait' to make it wait a while on the
+ * socket if there's no traffic.
  */
-CURLcode Curl_pp_easy_statemach(struct pingpong *pp);
-
+CURLcode Curl_pp_statemach(struct pingpong *pp, bool block);
 
 /* initialize stuff to prepare for reading a fresh new response */
 void Curl_pp_init(struct pingpong *pp);
@@ -100,9 +99,6 @@ long Curl_pp_state_timeout(struct pingpong *pp);
  * the string should not have any CRLF appended, as this function will
  * append the necessary things itself.
  *
- * NOTE: we build the command in a fixed-length buffer, which sets length
- * restrictions on the command!
- *
  * made to never block
  */
 CURLcode Curl_pp_sendf(struct pingpong *pp,
@@ -116,9 +112,6 @@ CURLcode Curl_pp_sendf(struct pingpong *pp,
  * the string should not have any CRLF appended, as this function will
  * append the necessary things itself.
  *
- * NOTE: we build the command in a fixed-length buffer, which sets length
- * restrictions on the command!
- *
  * made to never block
  */
 CURLcode Curl_pp_vsendf(struct pingpong *pp,
@@ -144,4 +137,14 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp);
 int Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks,
                     int numsocks);
 
-#endif /* __PINGPONG_H */
+
+/***********************************************************************
+ *
+ * Curl_pp_moredata()
+ *
+ * Returns whether there are still more data in the cache and so a call
+ * to Curl_pp_readresp() will not block.
+ */
+bool Curl_pp_moredata(struct pingpong *pp);
+
+#endif /* HEADER_CURL_PINGPONG_H */