当前位置:网站首页>Ssl/bio of OpenSSL_ get_ fd
Ssl/bio of OpenSSL_ get_ fd
2022-07-03 17:48:00 【Brother Xing plays with the clouds】
As long as it is used OpenSSL, There are always things that make people feel overwhelmed . This time it is SSL_get_fd. I created one in a very simple way SSL object , Directly on this object SSL Of accept:
bio = BIO_new(BIO_s_accept()); BIO_set_accept_port(bio, "1234"); BIO_do_accept(bio); SSL_set_bio(ssl, bio, bio); SSL_accept(ssl);
So you don't have to deal with annoying sockaddr 了 . Later, I thought about this SSL The bottom layer of object Association socket On the implementation setsockopt, Take it for granted SSL_get_fd/BIO_get_fd This is very self-evident API. So far, it's great . Then it's not cool , I find setsockiot The descriptor of the final operation is listnen Socket , instead of accept The socket returned . This seems to be API On the level, it is very reasonable , After all bio The parameter of is a BIO_s_accept, And what is associated with it is a listen Socket . Want to get the right accept Returned read / write socket The descriptor , You have to write this :
[plain] view plaincopyprint? stay CODE View the code slice on the screen and derive it to my code slice
BIO_get_fd(BIO_next(bio), &sd);
BIO_get_fd(BIO_next(bio), &sd); The problem is , You must know this BIO stack How is it arranged to write the above code , The best way to do this is to see OpenSSL Source code .
BIO Of API Design must be designed as get/set_fd Do you ?BIO You have to be with one fd Is it relevant ?memory Type of BIO If get fd Words , What kind of error will it return ? since BIO Constitute a superimposed IO stack, Then maybe the one at the bottom will be with one UNIX fd Related to , Then why not just go back to the bottom one ?
边栏推荐
- MinGW compile boost library
- Mathematical formula (test)
- [combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
- Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
- ArrayList分析3 : 删除元素
- [mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
- Swm32 series Tutorial 4 port mapping and serial port application
- Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
- Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028
- 鸿蒙第三次培训
猜你喜欢
Vs2013 has blocked the installer, and ie10 needs to be installed
Getting started with deops
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
BFS - topology sort
Kubernetes resource object introduction and common commands (III)
互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
How to read the source code [debug and observe the source code]
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
Embedded-c language-7
随机推荐
Talk about the design and implementation logic of payment process
Leetcode Valentine's Day Special - looking for a single dog
自动渗透测试工具核心功能简述
POM in idea XML graying solution
Talk about the design and implementation logic of payment process
Vs2013 has blocked the installer, and ie10 needs to be installed
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
1164 Good in C
AcWing 4489. Longest subsequence
Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
Getting started with deops
微服务组件Sentinel控制台调用
聊聊支付流程的设计与实现逻辑
Analyse ArrayList 3: suppression d'éléments
[mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
c# . Net tool ecosystem
vs2013已阻止安装程序,需安装IE10
Golang unit test, mock test and benchmark test
TensorBoard快速入门(Pytorch使用TensorBoard)
BFS - topology sort