00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "tool_setup.h"
00023
00024 #include "strcase.h"
00025
00026 #define ENABLE_CURLX_PRINTF
00027
00028 #include "curlx.h"
00029
00030 #include "tool_libinfo.h"
00031
00032 #include "memdebug.h"
00033
00034
00035
00036 curl_version_info_data *curlinfo = NULL;
00037 long built_in_protos = 0;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 CURLcode get_libcurl_info(void)
00048 {
00049 static struct proto_name_pattern {
00050 const char *proto_name;
00051 long proto_pattern;
00052 } const possibly_built_in[] = {
00053 { "dict", CURLPROTO_DICT },
00054 { "file", CURLPROTO_FILE },
00055 { "ftp", CURLPROTO_FTP },
00056 { "ftps", CURLPROTO_FTPS },
00057 { "gopher", CURLPROTO_GOPHER },
00058 { "http", CURLPROTO_HTTP },
00059 { "https", CURLPROTO_HTTPS },
00060 { "imap", CURLPROTO_IMAP },
00061 { "imaps", CURLPROTO_IMAPS },
00062 { "ldap", CURLPROTO_LDAP },
00063 { "ldaps", CURLPROTO_LDAPS },
00064 { "pop3", CURLPROTO_POP3 },
00065 { "pop3s", CURLPROTO_POP3S },
00066 { "rtmp", CURLPROTO_RTMP },
00067 { "rtsp", CURLPROTO_RTSP },
00068 { "scp", CURLPROTO_SCP },
00069 { "sftp", CURLPROTO_SFTP },
00070 { "smb", CURLPROTO_SMB },
00071 { "smbs", CURLPROTO_SMBS },
00072 { "smtp", CURLPROTO_SMTP },
00073 { "smtps", CURLPROTO_SMTPS },
00074 { "telnet", CURLPROTO_TELNET },
00075 { "tftp", CURLPROTO_TFTP },
00076 { NULL, 0 }
00077 };
00078
00079 struct proto_name_pattern const *p;
00080 const char *const *proto;
00081
00082
00083 curlinfo = curl_version_info(CURLVERSION_NOW);
00084 if(!curlinfo)
00085 return CURLE_FAILED_INIT;
00086
00087
00088 built_in_protos = 0;
00089 if(curlinfo->protocols) {
00090 for(proto = curlinfo->protocols; *proto; proto++) {
00091 for(p = possibly_built_in; p->proto_name; p++) {
00092 if(curl_strequal(*proto, p->proto_name)) {
00093 built_in_protos |= p->proto_pattern;
00094 break;
00095 }
00096 }
00097 }
00098 }
00099
00100 return CURLE_OK;
00101 }
00102