summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Nagel <wnagel@tycoint.com>2014-11-30 10:39:14 -0500
committerSteve Holme <steve_holme@hotmail.com>2014-11-30 15:56:30 +0000
commitaec2e865f06669b9cb5d26cc1148d70bc418b163 (patch)
treeb1089dd7cd9fbb8b465ba4724a9590c0d3fc8716
parent56120ca04bc6c0dc4e942504c7abf018b7ef8428 (diff)
downloadcurl-aec2e865f06669b9cb5d26cc1148d70bc418b163.tar.gz
smb: Added SMB handler interfaces
Added the SMB and SMBS handler interface structures and associated functions required for SMB/CIFS operation.
-rw-r--r--lib/smb.c121
-rw-r--r--lib/smb.h8
2 files changed, 129 insertions, 0 deletions
diff --git a/lib/smb.c b/lib/smb.c
index 066c2521b..3a082ca5e 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -28,8 +28,129 @@
#define BUILDING_CURL_SMB_C
#include "smb.h"
+#include "urldata.h"
+#include "sendf.h"
+#include "multiif.h"
/* The last #include file should be: */
#include "memdebug.h"
+/* Local API functions */
+static CURLcode smb_setup(struct connectdata *conn);
+static CURLcode smb_connect(struct connectdata *conn, bool *done);
+static CURLcode smb_connection_state(struct connectdata *conn, bool *done);
+static CURLcode smb_request_state(struct connectdata *conn, bool *done);
+static CURLcode smb_done(struct connectdata *conn, CURLcode status,
+ bool premature);
+static CURLcode smb_disconnect(struct connectdata *conn, bool dead);
+static int smb_getsock(struct connectdata *conn, curl_socket_t *socks,
+ int numsocks);
+
+/*
+ * SMB handler interface
+ */
+const struct Curl_handler Curl_handler_smb = {
+ "SMB", /* scheme */
+ smb_setup, /* setup_connection */
+ ZERO_NULL, /* do_it */
+ smb_done, /* done */
+ ZERO_NULL, /* do_more */
+ smb_connect, /* connect_it */
+ smb_connection_state, /* connecting */
+ smb_request_state, /* doing */
+ smb_getsock, /* proto_getsock */
+ smb_getsock, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
+ ZERO_NULL, /* perform_getsock */
+ smb_disconnect, /* disconnect */
+ ZERO_NULL, /* readwrite */
+ PORT_SMB, /* defport */
+ CURLPROTO_SMB, /* protocol */
+ PROTOPT_NONE /* flags */
+};
+
+#ifdef USE_SSL
+/*
+ * SMBS handler interface
+ */
+const struct Curl_handler Curl_handler_smbs = {
+ "SMBS", /* scheme */
+ smb_setup, /* setup_connection */
+ ZERO_NULL, /* do_it */
+ smb_done, /* done */
+ ZERO_NULL, /* do_more */
+ smb_connect, /* connect_it */
+ smb_connection_state, /* connecting */
+ smb_request_state, /* doing */
+ smb_getsock, /* proto_getsock */
+ smb_getsock, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
+ ZERO_NULL, /* perform_getsock */
+ smb_disconnect, /* disconnect */
+ ZERO_NULL, /* readwrite */
+ PORT_SMBS, /* defport */
+ CURLPROTO_SMBS, /* protocol */
+ PROTOPT_SSL /* flags */
+};
+#endif
+
+static CURLcode smb_setup(struct connectdata *conn)
+{
+ (void) conn;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static CURLcode smb_connect(struct connectdata *conn, bool *done)
+{
+ (void) conn;
+ (void) done;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static CURLcode smb_connection_state(struct connectdata *conn, bool *done)
+{
+ (void) conn;
+ (void) done;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static CURLcode smb_request_state(struct connectdata *conn, bool *done)
+{
+ (void) conn;
+ (void) done;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static CURLcode smb_done(struct connectdata *conn, CURLcode status,
+ bool premature)
+{
+ (void) conn;
+ (void) status;
+ (void) premature;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static CURLcode smb_disconnect(struct connectdata *conn, bool dead)
+{
+ (void) conn;
+ (void) dead;
+
+ return CURLE_NOT_BUILT_IN;
+}
+
+static int smb_getsock(struct connectdata *conn, curl_socket_t *socks,
+ int numsocks)
+{
+ (void) conn;
+ (void) socks;
+ (void) numsocks;
+
+ return GETSOCK_BLANK;
+}
+
#endif /* CURL_DISABLE_SMB && USE_NTLM && USE_WINDOWS_SSPI */
diff --git a/lib/smb.h b/lib/smb.h
index 63fdba814..0df3d1a99 100644
--- a/lib/smb.h
+++ b/lib/smb.h
@@ -256,4 +256,12 @@ struct smb_tree_disconnect {
#endif /* BUILDING_CURL_SMB_C */
+#if !defined(CURL_DISABLE_SMB) && defined(USE_NTLM) && \
+ !defined(USE_WINDOWS_SSPI)
+
+extern const struct Curl_handler Curl_handler_smb;
+extern const struct Curl_handler Curl_handler_smbs;
+
+#endif /* CURL_DISABLE_SMB && USE_NTLM && USE_WINDOWS_SSPI */
+
#endif /* HEADER_CURL_SMB_H */