当前位置:网站首页>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 ?
边栏推荐
- Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
- Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028
- Swm32 series Tutorial 4 port mapping and serial port application
- ArrayList分析3 : 删除元素
- Test your trained model
- Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
- 毕业总结
- AcWing 4489. 最长子序列
- Embedded-c language-7
- [combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
猜你喜欢
POM in idea XML graying solution
1146_ SiCp learning notes_ exponentiation
(8) HS corner detection
IntelliJ 2021.3 short command line when running applications
Automata and automatic line of non-standard design
Talk about the design and implementation logic of payment process
List的stream中Long对象与long判等问题记录
【JokerのZYNQ7020】DDS_ Compiler。
Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028
Wechat applet for the first time
随机推荐
Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
Golang单元测试、Mock测试以及基准测试
MySQL grouping query
【JokerのZYNQ7020】DDS_ Compiler。
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
Hongmeng third training
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
Implementation of Tetris in C language
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
[RT thread] NXP rt10xx device driver framework -- pin construction and use
[combinatorics] generating function (summation property)
Luogu: p2685 [tjoi2012] Bridge
1147_ Makefile learning_ Target files and dependent files in makefile
When absolutely positioned, the element is horizontally and vertically centered
PR second time
企业级自定义表单引擎解决方案(十一)--表单规则引擎1
鸿蒙第三次培训
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
Micro service component sentinel console call
TensorBoard快速入门(Pytorch使用TensorBoard)