-
Notifications
You must be signed in to change notification settings - Fork 239
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
support configurable interface name for wpantund. #2
support configurable interface name for wpantund. #2
Conversation
src/web/web-service/web_service.hpp
Outdated
@@ -57,12 +57,13 @@ namespace Web { | |||
|
|||
typedef SimpleWeb::Server<SimpleWeb::HTTP> HttpServer; | |||
|
|||
|
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.
nit: is this line needed?
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.
i will remove it, thanks.
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.
done.
@@ -45,15 +45,15 @@ namespace Dbus { | |||
|
|||
DBusConnection *DBusBase::GetConnection(void) | |||
{ | |||
dbus_error_init(&error); | |||
mConnection = dbus_bus_get(DBUS_BUS_STARTER, &error); | |||
dbus_error_init(&mError); |
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.
Is it better to make mError
as local variable?
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.
mError
is the member of the basic class, i think sub class could use it directly and no need to define the local variable again. Thanks.
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.
It's only meaningful in local scope. See one core component of OpenThread
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.
done.
dbus_bus_add_match(dbusConnection, dbusObjectManagerMatchString, &error); | ||
VerifyOrExit(error.name == NULL, ret = kWpantundStatus_Failure); | ||
dbus_bus_add_match(dbusConnection, dbusObjectManagerMatchString, &mError); | ||
VerifyOrExit(mError.name == NULL, ret = kWpantundStatus_Failure); |
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.
Is it better to use the documented API to check if error occurred? dbus_error_is_set()
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.
Good suggestion, i will use this API to check the failure.
exit: | ||
return ret; | ||
} | ||
|
||
const WpanNetworkInfo *WPANController::GetScanNetworksInfo(void) | ||
{ | ||
return gScanedNetowrks; | ||
return mScanedNetowrks; |
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.
typo here.
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.
I will modify it.
int Leave(void); | ||
int Form(const char *aNetworkname, int aChannel); | ||
int Scan(void); | ||
int Join(char *aNetworkname, int16_t aChannel, uint64_t aExtPanId, |
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.
const char *aNetworkName
?
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.
i will modify it.
@@ -37,6 +37,8 @@ | |||
#define WPAN_TUNNEL_DBUS_PATH "/com/nestlabs/WPANTunnelDriver" | |||
#define WPANTUND_DBUS_PATH "/org/wpantund" | |||
#define WPANTUND_DBUS_APIv1_INTERFACE "org.wpantund.v1" | |||
#define WPAN_TUNNEL_DBUS_INTERFACE "com.nestlabs.WPANTunnelDriver" |
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.
Is it possible to use the headers files in third_party/wpantund
?
ea69ea0
to
ca22cbb
Compare
src/web/main.cpp
Outdated
#include <syslog.h> | ||
#include <unistd.h> | ||
|
||
#include "otbr-config.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.
This should be the first included file.
src/web/main.cpp
Outdated
#include "web-service/web_service.hpp" | ||
#include "common/code_utils.hpp" |
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.
see [style guide]https://github.com/openthread/openthread/blob/master/STYLE_GUIDE.md
Preprocessor #include directives should be grouped, ordered, or sorted as follows:
- ..
- Alphanumeric order within each subgroup
src/web/main.cpp
Outdated
server.StartWebServer(); | ||
return 0; | ||
exit: | ||
server = NULL; |
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.
memory leak. server
not deleted.
@@ -88,6 +88,7 @@ class WebServer | |||
static int sNetworksCount; | |||
static std::string sNetowrkName, sExtPanId; | |||
static bool sIsStarted; | |||
char mIfName[DBUS_MAXIMUM_NAME_LENGTH + 1]; |
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.
Is this mIfName
related to DBUS?
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.
mIfName
records network interface such as "wpan0".
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.
If it's not related to D-Bus, refer http://pubs.opengroup.org/onlinepubs/009696699/functions/if_indextoname.html
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.
mIfName
is used to generate the parameters of the dbus_message_new_method_call
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.
According to source of web_service.cpp
, it seems mIfName
only holds a network interface name, which is independent of d-bus.
dbusIfName.SetInterfaceName(mIfName); | ||
VerifyOrExit(dbusIfName.ProcessReply() == kWpantundStatus_Ok, ret = kWpantundStatus_InvalidDBusName); | ||
exit: | ||
return ret ? NULL : dbusIfName.GetDBusName(); |
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.
Is this actually returning a temporary stack address of dbusIfName::GetDBusName()
?
0af9094
to
6931529
Compare
6931529
to
a2bf4eb
Compare
…e-options to staging/fix/cmake-package-options * commit '82943e84c02ed2c0fc6022942807b92ebbee5e01': Remove defaults for package name and version for the OpenThread border router, so that vendors can set their own values for it.
No description provided.