aboutsummaryrefslogtreecommitdiff
path: root/lib/urldata.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-14 22:22:22 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-14 22:22:22 +0100
commit8831000bc07de463d277975a3ddfb6a31dcf14b4 (patch)
tree0313bc919a3ee27021c352e9efad38ad8c62407e /lib/urldata.h
parented8749e308a9ed0da49ad46b8b2ba5e8aae80244 (diff)
protocol handler: added flags field
The protocol handler struct got a 'flags' field for special information and characteristics of the given protocol. This now enables us to move away central protocol information such as CLOSEACTION and DUALCHANNEL from single defines in a central place, out to each protocol's definition. It also made us stop abusing the protocol field for other info than the protocol, and we could start cleaning up other protocol-specific things by adding flags bits to set in the handler struct. The "protocol" field connectdata struct was removed as well and the code now refers directly to the conn->handler->protocol field instead. To make things work properly, the code now always store a conn->given pointer that points out the original handler struct so that the code can learn details from the original protocol even if conn->handler is modified along the way - for example when switching to go over a HTTP proxy.
Diffstat (limited to 'lib/urldata.h')
-rw-r--r--lib/urldata.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/urldata.h b/lib/urldata.h
index 2f7fe5e41..20cce14a4 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -694,8 +694,9 @@ struct Curl_handler {
*/
CURLcode (*disconnect)(struct connectdata *, bool dead_connection);
- long defport; /* Default port. */
- long protocol; /* PROT_* flags concerning the protocol set */
+ long defport; /* Default port. */
+ unsigned int protocol; /* PROT_* flags concerning the protocol set */
+ unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */
};
/* return the count of bytes sent, or -1 on error */
@@ -735,7 +736,7 @@ struct connectdata {
/**** Fields set when inited and not modified again */
long connectindex; /* what index in the connection cache connects index this
particular struct has */
- long protocol; /* PROT_* flags concerning the protocol set */
+
#define PROT_HTTP CURLPROTO_HTTP
#define PROT_HTTPS CURLPROTO_HTTPS
#define PROT_FTP CURLPROTO_FTP
@@ -762,24 +763,18 @@ struct connectdata {
#define PROT_RTMPTS CURLPROTO_RTMPTS
#define PROT_GOPHER CURLPROTO_GOPHER
-/* (1<<25) is currently the highest used bit in the public bitmask. We make
- sure we use "private bits" above the public ones to make things easier;
- Gopher will not conflict with the current bit 25. */
-
-#define PROT_EXTMASK 0x03ffffff
-
-#define PROT_SSL (1<<29) /* protocol requires SSL */
-
-/* these ones need action before socket close */
-#define PROT_CLOSEACTION (PROT_FTP | PROT_IMAP | PROT_POP3 | \
- PROT_SFTP | PROT_SCP)
-#define PROT_DUALCHANNEL PROT_FTP /* these protocols use two connections */
+#define PROT_ALL ~0
+#define PROTOPT_NONE 0 /* nothing extra */
+#define PROTOPT_SSL (1<<0) /* uses SSL */
+#define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */
+#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */
/* some protocols will have to call the underlying functions without regard to
what exact state the socket signals. IE even if the socket says "readable",
the send function might need to be called while uploading, or vice versa.
*/
-#define PROT_LOCKEDBITS (PROT_SCP | PROT_SFTP)
+#define PROTOPT_DIRLOCK (1<<3)
+#define PROTOPT_BANPROXY (1<<4) /* not allowed to use proxy */
/* 'dns_entry' is the particular host we use. This points to an entry in the
DNS cache and it will not get pruned while locked. It gets unlocked in
@@ -857,7 +852,8 @@ struct connectdata {
long timeoutms_per_addr; /* how long time in milliseconds to spend on
trying to connect to each IP address */
- const struct Curl_handler * handler; /* Connection's protocol handler. */
+ const struct Curl_handler *handler; /* Connection's protocol handler */
+ const struct Curl_handler *given; /* The protocol first given */
long ip_version; /* copied from the SessionHandle at creation time */