Skip to content
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

Conversation

LeZhang2016
Copy link

No description provided.

@@ -57,12 +57,13 @@ namespace Web {

typedef SimpleWeb::Server<SimpleWeb::HTTP> HttpServer;


Copy link
Member

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?

Copy link
Author

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.

Copy link
Author

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);
Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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

Copy link
Author

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);
Copy link
Member

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()

Copy link
Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here.

Copy link
Author

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const char *aNetworkName?

Copy link
Author

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"
Copy link
Member

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?

@LeZhang2016 LeZhang2016 force-pushed the feature-configurable-interfaceName branch from ea69ea0 to ca22cbb Compare May 30, 2017 14:00
src/web/main.cpp Outdated
#include <syslog.h>
#include <unistd.h>

#include "otbr-config.h"
Copy link
Member

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"
Copy link
Member

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;
Copy link
Member

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];
Copy link
Member

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?

Copy link
Author

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".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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

Copy link
Member

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();
Copy link
Member

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()?

@LeZhang2016 LeZhang2016 force-pushed the feature-configurable-interfaceName branch 3 times, most recently from 0af9094 to 6931529 Compare May 30, 2017 14:57
@LeZhang2016 LeZhang2016 force-pushed the feature-configurable-interfaceName branch from 6931529 to a2bf4eb Compare May 30, 2017 15:13
suveshpratapa referenced this pull request in SiliconLabs/ot-br-posix Mar 30, 2021
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants