当前位置: 首页 > news >正文

curl之网络接口

Curl_cftype

连接接口定义

struct Curl_cftype {const char *name;                       /* name of the filter type */int flags;                              /* flags of filter type */int log_level;                          /* log level for such filters */Curl_cft_destroy_this *destroy;         /* destroy resources of this cf */Curl_cft_connect *do_connect;           /* establish connection */Curl_cft_close *do_close;               /* close conn */Curl_cft_get_host *get_host;            /* host filter talks to */Curl_cft_adjust_pollset *adjust_pollset; /* adjust transfer poll set */Curl_cft_data_pending *has_data_pending;/* conn has data pending */Curl_cft_send *do_send;                 /* send data */Curl_cft_recv *do_recv;                 /* receive data */Curl_cft_cntrl *cntrl;                  /* events/control */Curl_cft_conn_is_alive *is_alive;       /* FALSE if conn is dead, Jim! */Curl_cft_conn_keep_alive *keep_alive;   /* try to keep it alive */Curl_cft_query *query;                  /* query filter chain */
};

初始化Curl_cftype类型数组

数组定义为struct Curl_cftype *cf_types

static struct Curl_cftype *cf_types[] = {&Curl_cft_tcp,&Curl_cft_udp,&Curl_cft_unix,&Curl_cft_tcp_accept,&Curl_cft_happy_eyeballs,&Curl_cft_setup,
#ifdef USE_NGHTTP2&Curl_cft_nghttp2,
#endif
#ifdef USE_SSL&Curl_cft_ssl,
#ifndef CURL_DISABLE_PROXY&Curl_cft_ssl_proxy,
#endif
#endif
#if !defined(CURL_DISABLE_PROXY)
#if !defined(CURL_DISABLE_HTTP)&Curl_cft_h1_proxy,
#ifdef USE_NGHTTP2&Curl_cft_h2_proxy,
#endif&Curl_cft_http_proxy,
#endif /* !CURL_DISABLE_HTTP */&Curl_cft_haproxy,&Curl_cft_socks_proxy,
#endif /* !CURL_DISABLE_PROXY */
#ifdef ENABLE_QUIC&Curl_cft_http3,
#endif
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)&Curl_cft_http_connect,
#endifNULL,
};

Curl_cfilter

连接处理链

struct Curl_cfilter {const struct Curl_cftype *cft; /* the type providing implementation */struct Curl_cfilter *next;     /* next filter in chain */void *ctx;                     /* filter type specific settings */struct connectdata *conn;      /* the connection this filter belongs to */int sockindex;                 /* the index the filter is installed at */BIT(connected);                /* != 0 iff this filter is connected */
};

transport_provider

定义如下

struct transport_provider {int transport;cf_ip_connect_create *cf_create;
};

初始化代码为

struct transport_provider transport_providers[] = {{ TRNSPRT_TCP, Curl_cf_tcp_create },
#ifdef ENABLE_QUIC{ TRNSPRT_QUIC, Curl_cf_quic_create },
#endif
#ifndef CURL_DISABLE_TFTP{ TRNSPRT_UDP, Curl_cf_udp_create },
#endif
#ifdef USE_UNIX_SOCKETS{ TRNSPRT_UNIX, Curl_cf_unix_create },
#endif
};
http://www.lryc.cn/news/292597.html

相关文章:

  • Pytest中doctests的测试方法应用
  • Android 8.1 铃声音量通话音量同步调节
  • C++——字符串string
  • HBuilder使用[微信小程序开发者工具] 显示 × initialize报错
  • 洛谷P8599 [蓝桥杯 2013 省 B] 带分数
  • grafana安装DevOpsProdigy KubeGraf 1.5.2
  • 大数据 - Hadoop系列《三》- MapReduce(分布式计算引擎)概述
  • 了解Ansible自动化运维工具及模块的使用
  • sql指南之null值用法
  • 常见消息队列:ActiveMQ、RabbitMQ、RocketMQ、Kafka的区别总结
  • 火柴人大逃亡
  • AI革命新篇章:法国天才团队挑战ChatGPT霸主地位
  • 数据双向绑定v-modal
  • Docker 容器jar 运行报错 at sun.awt.FontConfiguration.getVersion 解决方法
  • 光学3D表面轮廓仪服务超精密抛光技术发展
  • 详解C++中auto关键字
  • 24.云原生ArgoCD高级之数据加密seale sealed
  • 线性代数:线性方程组
  • 标准的排序组合-算法
  • 2402C++,C++递归取各种节点名字
  • Qt 5.9.4 转 Qt 6.6.1 遇到的问题总结(三)
  • Logstash 7.7.1版本安装系统梳理
  • 4. sass实用函数归纳
  • 《元梦之星》赛季更新带来“新”内容,为何却被玩家集体声讨?
  • 故障诊断 | 一文解决,CNN-SVM卷积神经网络-支持向量机组合模型的故障诊断(Matlab)
  • 菜鸡后端的前端学习记录-2
  • Layui + Echarts 5.0
  • linux使用iptables禁用ip
  • 安全防御第五次作业
  • 分库分表原则