-
Notifications
You must be signed in to change notification settings - Fork 343
Refactor Signaling sources to make Include_i.h
independent of libwebsockets
#2141
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
base: develop
Are you sure you want to change the base?
Refactor Signaling sources to make Include_i.h
independent of libwebsockets
#2141
Conversation
@@ -65,6 +63,7 @@ extern "C" { | |||
#include <arpa/inet.h> | |||
#include <fcntl.h> | |||
#include <netinet/tcp.h> | |||
#include <poll.h> |
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.
Because this was earlier satisfied from libwebsockets.h
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.
To make this platform independent, I think we should pass it as a compiler flag and only include if true.
cmake:
include(CheckIncludeFile)
check_include_file("poll.h" HAVE_POLL_H)
if(HAVE_POLL_H)
add_definitions(-DHAVE_POLL_H=1)
endif()
C:
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
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.
Maybe similar for ifaddrs.h
@@ -167,11 +167,14 @@ extern "C" { | |||
// Encoded max ice server infos string len | |||
#define MAX_ENCODED_ICE_SERVER_INFOS_STR_LEN (MAX_ICE_SERVER_INFOS_STR_LEN + ICE_SERVER_INFO_TEMPLATE_BLOAT_SIZE) | |||
|
|||
// Alignment bytes for libwebsockets (Internally, it might end up using lesser than 16) |
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.
LWS_PRE is libwebsockets defined macro! We just use 16 bytes extra than required by message. libwebsockets can freely use these extra 16 bytes for its alignment needs.
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.
Seems like it would eventually make sense to have an "ApiCalls" interface to abstract away lws (similar to how Tls.h is setup).
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.
My first thoughts were to have a function pointers structure and have it initialised with the required ApiCalls by the implementation. (The default would be the libwebsockets).
I think that would be more involved re-structuring. This one simply keeps everything at places just making headers more implementation dependent.
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.
Changes look good, thanks for all the hard work!
@@ -167,11 +167,14 @@ extern "C" { | |||
// Encoded max ice server infos string len | |||
#define MAX_ENCODED_ICE_SERVER_INFOS_STR_LEN (MAX_ICE_SERVER_INFOS_STR_LEN + ICE_SERVER_INFO_TEMPLATE_BLOAT_SIZE) | |||
|
|||
// Alignment bytes for libwebsockets (Internally, it might end up using lesser than 16) |
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.
Seems like it would eventually make sense to have an "ApiCalls" interface to abstract away lws (similar to how Tls.h is setup).
…bsockets - This way, one could write a new CMakeLists.txt, with ApiCalls using different websocket implementation - One should simply remove existing Signaling.c and LwsApiCalls.c from compilation and add their own
e90a7c8
to
f2be2ca
Compare
What was changed?
Why was it changed?