-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: move mbedtls sockets into its own layer under connection #475
Conversation
* | ||
* @param socket The socket structure to free resources from | ||
*/ | ||
void atclient_raw_socket_free(struct atclient_raw_socket *socket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raw sockets only have init and free for now. I plan to add more functionality later, but all we need is init and free right now, as the ssl context takes ownership of the object.
535d367
to
27129fc
Compare
27129fc
to
05dced7
Compare
#ifndef ATCLIENT_CONNECTION_H | ||
#define ATCLIENT_CONNECTION_H | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "atchops/mbedtls.h" | ||
#include "atclient/connection_hooks.h" | ||
#include <atchops/platform.h> // IWYU pragma: keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platform needs to be first, as socket depends on a value in it.
|
||
uint16_t port; // example: 64 | ||
bool _is_host_initialized : 1; | ||
char *host; // example: "root.atsign.org" | ||
|
||
bool _is_port_initialized : 1; | ||
uint16_t port; // example: 64 | ||
bool _is_connection_enabled : 1; | ||
bool _is_hooks_enabled : 1; | ||
|
||
char *host; // example: "root.atsign.org" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouped the booleans in this struct to marginally improve the alignment. Since the alignment is quite high, should help reduce the chances of cache misses
@cpswan it's worth discussing how we want to test this. It is tested through functional tests with notify, monitor, connection, pkam_authenticate & get_atkeys. But we now have the ability to test the pure tls socket client, we would need to create a test harness though. |
@XavierChanth agree that more tests would be good, though maybe open a fresh issue for those. |
9599ed8
to
c14e6d0
Compare
c14e6d0
to
41ca30a
Compare
41ca30a
to
e36b593
Compare
- What I did
Moved TLS sockets into a generic interface
TLS socket implementation can be swapped out without the need to reimplement all of connection which also contains a bunch of parsing logic
- How I did it
- How to verify it
- Description for the changelog
feat: move mbedtls sockets into its own layer under connection