From f4cfad361175a7f9ccf4d41e76a9b289c3c3da22 Mon Sep 17 00:00:00 2001 From: Sreeram Ramachandran Date: Wed, 21 May 2014 08:54:07 -0700 Subject: [PATCH] Move netd_client into netd. Change-Id: Ie4b6b303225c93f2448a503d6ea9cebb552cbad5 --- client/Android.mk | 23 ++++++ client/FwmarkClient.cpp | 96 ++++++++++++++++++++++ client/FwmarkClient.h | 38 +++++++++ client/NetdClient.cpp | 84 +++++++++++++++++++ include/FwmarkCommand.h | 29 +++++++ Android.mk => server/Android.mk | 1 + .../BandwidthController.cpp | 0 .../BandwidthController.h | 0 ClatdController.cpp => server/ClatdController.cpp | 0 ClatdController.h => server/ClatdController.h | 0 CleanSpec.mk => server/CleanSpec.mk | 0 CommandListener.cpp => server/CommandListener.cpp | 0 CommandListener.h => server/CommandListener.h | 0 .../DnsProxyListener.cpp | 0 DnsProxyListener.h => server/DnsProxyListener.h | 0 .../FirewallController.cpp | 0 .../FirewallController.h | 0 Fwmark.h => server/Fwmark.h | 6 +- FwmarkServer.cpp => server/FwmarkServer.cpp | 2 +- FwmarkServer.h => server/FwmarkServer.h | 6 +- .../IdletimerController.cpp | 0 .../IdletimerController.h | 0 .../InterfaceController.cpp | 0 .../InterfaceController.h | 0 List.h => server/List.h | 0 MDnsSdListener.cpp => server/MDnsSdListener.cpp | 0 MDnsSdListener.h => server/MDnsSdListener.h | 0 NatController.cpp => server/NatController.cpp | 0 NatController.h => server/NatController.h | 0 NetdCommand.cpp => server/NetdCommand.cpp | 0 NetdCommand.h => server/NetdCommand.h | 0 NetdConstants.cpp => server/NetdConstants.cpp | 0 NetdConstants.h => server/NetdConstants.h | 0 NetlinkHandler.cpp => server/NetlinkHandler.cpp | 0 NetlinkHandler.h => server/NetlinkHandler.h | 0 NetlinkManager.cpp => server/NetlinkManager.cpp | 0 NetlinkManager.h => server/NetlinkManager.h | 0 .../NetworkController.cpp | 0 NetworkController.h => server/NetworkController.h | 0 Permission.cpp => server/Permission.cpp | 0 Permission.h => server/Permission.h | 6 +- .../PermissionsController.cpp | 0 .../PermissionsController.h | 6 +- PppController.cpp => server/PppController.cpp | 0 PppController.h => server/PppController.h | 0 .../ResolverController.cpp | 0 .../ResolverController.h | 0 ResponseCode.h => server/ResponseCode.h | 0 RouteController.cpp => server/RouteController.cpp | 0 RouteController.h => server/RouteController.h | 6 +- .../SecondaryTableController.cpp | 0 .../SecondaryTableController.h | 0 .../SoftapController.cpp | 0 SoftapController.h => server/SoftapController.h | 0 .../TetherController.cpp | 0 TetherController.h => server/TetherController.h | 0 main.cpp => server/main.cpp | 0 ndc.c => server/ndc.c | 0 .../oem_iptables_hook.cpp | 0 oem_iptables_hook.h => server/oem_iptables_hook.h | 0 60 files changed, 287 insertions(+), 16 deletions(-) create mode 100644 client/Android.mk create mode 100644 client/FwmarkClient.cpp create mode 100644 client/FwmarkClient.h create mode 100644 client/NetdClient.cpp create mode 100644 include/FwmarkCommand.h rename Android.mk => server/Android.mk (98%) rename BandwidthController.cpp => server/BandwidthController.cpp (100%) rename BandwidthController.h => server/BandwidthController.h (100%) rename ClatdController.cpp => server/ClatdController.cpp (100%) rename ClatdController.h => server/ClatdController.h (100%) rename CleanSpec.mk => server/CleanSpec.mk (100%) rename CommandListener.cpp => server/CommandListener.cpp (100%) rename CommandListener.h => server/CommandListener.h (100%) rename DnsProxyListener.cpp => server/DnsProxyListener.cpp (100%) rename DnsProxyListener.h => server/DnsProxyListener.h (100%) rename FirewallController.cpp => server/FirewallController.cpp (100%) rename FirewallController.h => server/FirewallController.h (100%) rename Fwmark.h => server/Fwmark.h (92%) rename FwmarkServer.cpp => server/FwmarkServer.cpp (99%) rename FwmarkServer.h => server/FwmarkServer.h (91%) rename IdletimerController.cpp => server/IdletimerController.cpp (100%) rename IdletimerController.h => server/IdletimerController.h (100%) rename InterfaceController.cpp => server/InterfaceController.cpp (100%) rename InterfaceController.h => server/InterfaceController.h (100%) rename List.h => server/List.h (100%) rename MDnsSdListener.cpp => server/MDnsSdListener.cpp (100%) rename MDnsSdListener.h => server/MDnsSdListener.h (100%) rename NatController.cpp => server/NatController.cpp (100%) rename NatController.h => server/NatController.h (100%) rename NetdCommand.cpp => server/NetdCommand.cpp (100%) rename NetdCommand.h => server/NetdCommand.h (100%) rename NetdConstants.cpp => server/NetdConstants.cpp (100%) rename NetdConstants.h => server/NetdConstants.h (100%) rename NetlinkHandler.cpp => server/NetlinkHandler.cpp (100%) rename NetlinkHandler.h => server/NetlinkHandler.h (100%) rename NetlinkManager.cpp => server/NetlinkManager.cpp (100%) rename NetlinkManager.h => server/NetlinkManager.h (100%) rename NetworkController.cpp => server/NetworkController.cpp (100%) rename NetworkController.h => server/NetworkController.h (100%) rename Permission.cpp => server/Permission.cpp (100%) rename Permission.h => server/Permission.h (94%) rename PermissionsController.cpp => server/PermissionsController.cpp (100%) rename PermissionsController.h => server/PermissionsController.h (89%) rename PppController.cpp => server/PppController.cpp (100%) rename PppController.h => server/PppController.h (100%) rename ResolverController.cpp => server/ResolverController.cpp (100%) rename ResolverController.h => server/ResolverController.h (100%) rename ResponseCode.h => server/ResponseCode.h (100%) rename RouteController.cpp => server/RouteController.cpp (100%) rename RouteController.h => server/RouteController.h (92%) rename SecondaryTableController.cpp => server/SecondaryTableController.cpp (100%) rename SecondaryTableController.h => server/SecondaryTableController.h (100%) rename SoftapController.cpp => server/SoftapController.cpp (100%) rename SoftapController.h => server/SoftapController.h (100%) rename TetherController.cpp => server/TetherController.cpp (100%) rename TetherController.h => server/TetherController.h (100%) rename main.cpp => server/main.cpp (100%) rename ndc.c => server/ndc.c (100%) rename oem_iptables_hook.cpp => server/oem_iptables_hook.cpp (100%) rename oem_iptables_hook.h => server/oem_iptables_hook.h (100%) diff --git a/client/Android.mk b/client/Android.mk new file mode 100644 index 0000000..2a4878c --- /dev/null +++ b/client/Android.mk @@ -0,0 +1,23 @@ +# Copyright (C) 2014 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := system/netd/include +LOCAL_MODULE := libnetd_client +LOCAL_SRC_FILES := FwmarkClient.cpp NetdClient.cpp + +include $(BUILD_SHARED_LIBRARY) diff --git a/client/FwmarkClient.cpp b/client/FwmarkClient.cpp new file mode 100644 index 0000000..e360b4e --- /dev/null +++ b/client/FwmarkClient.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "FwmarkClient.h" + +#include +#include +#include +#include + +namespace { + +const sockaddr_un FWMARK_SERVER_PATH = {AF_UNIX, "/dev/socket/fwmarkd"}; + +} // namespace + +bool FwmarkClient::shouldSetFwmark(int sockfd, const sockaddr* addr) { + return sockfd >= 0 && addr && (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) && + !getenv("ANDROID_NO_USE_FWMARK_CLIENT"); +} + +FwmarkClient::FwmarkClient() : mChannel(-1) { +} + +FwmarkClient::~FwmarkClient() { + if (mChannel >= 0) { + // We don't care about errors while closing the channel, so restore any previous error. + int error = errno; + close(mChannel); + errno = error; + } +} + +bool FwmarkClient::send(void* data, size_t len, int fd) { + mChannel = socket(AF_UNIX, SOCK_STREAM, 0); + if (mChannel == -1) { + return false; + } + + if (TEMP_FAILURE_RETRY(connect(mChannel, reinterpret_cast(&FWMARK_SERVER_PATH), + sizeof(FWMARK_SERVER_PATH))) == -1) { + // If we are unable to connect to the fwmark server, assume there's no error. This protects + // against future changes if the fwmark server goes away. + errno = 0; + return true; + } + + iovec iov; + iov.iov_base = data; + iov.iov_len = len; + + msghdr message; + memset(&message, 0, sizeof(message)); + message.msg_iov = &iov; + message.msg_iovlen = 1; + + union { + cmsghdr cmh; + char cmsg[CMSG_SPACE(sizeof(fd))]; + } cmsgu; + + memset(cmsgu.cmsg, 0, sizeof(cmsgu.cmsg)); + message.msg_control = cmsgu.cmsg; + message.msg_controllen = sizeof(cmsgu.cmsg); + + cmsghdr* const cmsgh = CMSG_FIRSTHDR(&message); + cmsgh->cmsg_len = CMSG_LEN(sizeof(fd)); + cmsgh->cmsg_level = SOL_SOCKET; + cmsgh->cmsg_type = SCM_RIGHTS; + memcpy(CMSG_DATA(cmsgh), &fd, sizeof(fd)); + + if (TEMP_FAILURE_RETRY(sendmsg(mChannel, &message, 0)) == -1) { + return false; + } + + int error = 0; + if (TEMP_FAILURE_RETRY(recv(mChannel, &error, sizeof(error), 0)) == -1) { + return false; + } + + errno = error; + return !error; +} diff --git a/client/FwmarkClient.h b/client/FwmarkClient.h new file mode 100644 index 0000000..f53de1c --- /dev/null +++ b/client/FwmarkClient.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NETD_CLIENT_FWMARK_CLIENT_H +#define NETD_CLIENT_FWMARK_CLIENT_H + +#include + +class FwmarkClient { +public: + // Returns true if |sockfd| should be sent to the fwmark server to have its SO_MARK set. + static bool shouldSetFwmark(int sockfd, const sockaddr* addr); + + FwmarkClient(); + ~FwmarkClient(); + + // Sends |data| to the fwmark server, along with |fd| as ancillary data using cmsg(3). + // Returns true on success. + bool send(void* data, size_t len, int fd); + +private: + int mChannel; +}; + +#endif // NETD_CLIENT_FWMARK_CLIENT_H diff --git a/client/NetdClient.cpp b/client/NetdClient.cpp new file mode 100644 index 0000000..2e8390c --- /dev/null +++ b/client/NetdClient.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "FwmarkClient.h" +#include "FwmarkCommand.h" + +#include +#include + +namespace { + +int closeFdAndRestoreErrno(int fd) { + int error = errno; + close(fd); + errno = error; + return -1; +} + +typedef int (*ConnectFunctionType)(int, const sockaddr*, socklen_t); +typedef int (*AcceptFunctionType)(int, sockaddr*, socklen_t*); + +ConnectFunctionType libcConnect = 0; +AcceptFunctionType libcAccept = 0; + +int netdClientConnect(int sockfd, const sockaddr* addr, socklen_t addrlen) { + if (FwmarkClient::shouldSetFwmark(sockfd, addr)) { + char data[] = {FWMARK_COMMAND_ON_CONNECT}; + if (!FwmarkClient().send(data, sizeof(data), sockfd)) { + return -1; + } + } + return libcConnect(sockfd, addr, addrlen); +} + +int netdClientAccept(int sockfd, sockaddr* addr, socklen_t* addrlen) { + int acceptedSocket = libcAccept(sockfd, addr, addrlen); + if (acceptedSocket == -1) { + return -1; + } + sockaddr socketAddress; + if (!addr) { + socklen_t socketAddressLen = sizeof(socketAddress); + if (getsockname(acceptedSocket, &socketAddress, &socketAddressLen) == -1) { + return closeFdAndRestoreErrno(acceptedSocket); + } + addr = &socketAddress; + } + if (FwmarkClient::shouldSetFwmark(acceptedSocket, addr)) { + char data[] = {FWMARK_COMMAND_ON_ACCEPT}; + if (!FwmarkClient().send(data, sizeof(data), acceptedSocket)) { + return closeFdAndRestoreErrno(acceptedSocket); + } + } + return acceptedSocket; +} + +} // namespace + +extern "C" void netdClientInitConnect(ConnectFunctionType* function) { + if (function && *function) { + libcConnect = *function; + *function = netdClientConnect; + } +} + +extern "C" void netdClientInitAccept(AcceptFunctionType* function) { + if (function && *function) { + libcAccept = *function; + *function = netdClientAccept; + } +} diff --git a/include/FwmarkCommand.h b/include/FwmarkCommand.h new file mode 100644 index 0000000..5854a81 --- /dev/null +++ b/include/FwmarkCommand.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NETD_INCLUDE_FWMARK_COMMAND_H +#define NETD_INCLUDE_FWMARK_COMMAND_H + +#include + +// Commands sent from clients to the fwmark server to mark sockets (i.e., set their SO_MARK). +const uint8_t FWMARK_COMMAND_ON_CREATE = 0; +const uint8_t FWMARK_COMMAND_ON_CONNECT = 1; +const uint8_t FWMARK_COMMAND_ON_ACCEPT = 2; +const uint8_t FWMARK_COMMAND_SELECT_NETWORK = 3; +const uint8_t FWMARK_COMMAND_PROTECT_FROM_VPN = 4; + +#endif // NETD_INCLUDE_FWMARK_COMMAND_H diff --git a/Android.mk b/server/Android.mk similarity index 98% rename from Android.mk rename to server/Android.mk index 8e13130..f2c9c4b 100644 --- a/Android.mk +++ b/server/Android.mk @@ -38,6 +38,7 @@ LOCAL_C_INCLUDES := \ external/stlport/stlport \ bionic \ bionic/libc/dns/include \ + system/netd/include \ $(call include-path-for, libhardware_legacy)/hardware_legacy LOCAL_CFLAGS := -Werror=format diff --git a/BandwidthController.cpp b/server/BandwidthController.cpp similarity index 100% rename from BandwidthController.cpp rename to server/BandwidthController.cpp diff --git a/BandwidthController.h b/server/BandwidthController.h similarity index 100% rename from BandwidthController.h rename to server/BandwidthController.h diff --git a/ClatdController.cpp b/server/ClatdController.cpp similarity index 100% rename from ClatdController.cpp rename to server/ClatdController.cpp diff --git a/ClatdController.h b/server/ClatdController.h similarity index 100% rename from ClatdController.h rename to server/ClatdController.h diff --git a/CleanSpec.mk b/server/CleanSpec.mk similarity index 100% rename from CleanSpec.mk rename to server/CleanSpec.mk diff --git a/CommandListener.cpp b/server/CommandListener.cpp similarity index 100% rename from CommandListener.cpp rename to server/CommandListener.cpp diff --git a/CommandListener.h b/server/CommandListener.h similarity index 100% rename from CommandListener.h rename to server/CommandListener.h diff --git a/DnsProxyListener.cpp b/server/DnsProxyListener.cpp similarity index 100% rename from DnsProxyListener.cpp rename to server/DnsProxyListener.cpp diff --git a/DnsProxyListener.h b/server/DnsProxyListener.h similarity index 100% rename from DnsProxyListener.h rename to server/DnsProxyListener.h diff --git a/FirewallController.cpp b/server/FirewallController.cpp similarity index 100% rename from FirewallController.cpp rename to server/FirewallController.cpp diff --git a/FirewallController.h b/server/FirewallController.h similarity index 100% rename from FirewallController.h rename to server/FirewallController.h diff --git a/Fwmark.h b/server/Fwmark.h similarity index 92% rename from Fwmark.h rename to server/Fwmark.h index d358f81..4ff2a37 100644 --- a/Fwmark.h +++ b/server/Fwmark.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SYSTEM_NETD_FWMARK_H -#define SYSTEM_NETD_FWMARK_H +#ifndef NETD_SERVER_FWMARK_H +#define NETD_SERVER_FWMARK_H #include "Permission.h" @@ -42,4 +42,4 @@ COMPILE_TIME_ASSERT(sizeof(Fwmark) == sizeof(uint32_t)); } // namespace android -#endif // SYSTEM_NETD_FWMARK_H +#endif // NETD_SERVER_FWMARK_H diff --git a/FwmarkServer.cpp b/server/FwmarkServer.cpp similarity index 99% rename from FwmarkServer.cpp rename to server/FwmarkServer.cpp index ea997ba..187d4bf 100644 --- a/FwmarkServer.cpp +++ b/server/FwmarkServer.cpp @@ -17,10 +17,10 @@ #include "FwmarkServer.h" #include "Fwmark.h" +#include "FwmarkCommand.h" #include "NetworkController.h" #include "PermissionsController.h" -#include "netd_client/FwmarkCommands.h" #include #include diff --git a/FwmarkServer.h b/server/FwmarkServer.h similarity index 91% rename from FwmarkServer.h rename to server/FwmarkServer.h index 4d58fd5..5629bf9 100644 --- a/FwmarkServer.h +++ b/server/FwmarkServer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SYSTEM_NETD_FWMARK_SERVER_H -#define SYSTEM_NETD_FWMARK_SERVER_H +#ifndef NETD_SERVER_FWMARK_SERVER_H +#define NETD_SERVER_FWMARK_SERVER_H #include @@ -38,4 +38,4 @@ private: PermissionsController* const mPermissionsController; }; -#endif // SYSTEM_NETD_FWMARK_SERVER_H +#endif // NETD_SERVER_FWMARK_SERVER_H diff --git a/IdletimerController.cpp b/server/IdletimerController.cpp similarity index 100% rename from IdletimerController.cpp rename to server/IdletimerController.cpp diff --git a/IdletimerController.h b/server/IdletimerController.h similarity index 100% rename from IdletimerController.h rename to server/IdletimerController.h diff --git a/InterfaceController.cpp b/server/InterfaceController.cpp similarity index 100% rename from InterfaceController.cpp rename to server/InterfaceController.cpp diff --git a/InterfaceController.h b/server/InterfaceController.h similarity index 100% rename from InterfaceController.h rename to server/InterfaceController.h diff --git a/List.h b/server/List.h similarity index 100% rename from List.h rename to server/List.h diff --git a/MDnsSdListener.cpp b/server/MDnsSdListener.cpp similarity index 100% rename from MDnsSdListener.cpp rename to server/MDnsSdListener.cpp diff --git a/MDnsSdListener.h b/server/MDnsSdListener.h similarity index 100% rename from MDnsSdListener.h rename to server/MDnsSdListener.h diff --git a/NatController.cpp b/server/NatController.cpp similarity index 100% rename from NatController.cpp rename to server/NatController.cpp diff --git a/NatController.h b/server/NatController.h similarity index 100% rename from NatController.h rename to server/NatController.h diff --git a/NetdCommand.cpp b/server/NetdCommand.cpp similarity index 100% rename from NetdCommand.cpp rename to server/NetdCommand.cpp diff --git a/NetdCommand.h b/server/NetdCommand.h similarity index 100% rename from NetdCommand.h rename to server/NetdCommand.h diff --git a/NetdConstants.cpp b/server/NetdConstants.cpp similarity index 100% rename from NetdConstants.cpp rename to server/NetdConstants.cpp diff --git a/NetdConstants.h b/server/NetdConstants.h similarity index 100% rename from NetdConstants.h rename to server/NetdConstants.h diff --git a/NetlinkHandler.cpp b/server/NetlinkHandler.cpp similarity index 100% rename from NetlinkHandler.cpp rename to server/NetlinkHandler.cpp diff --git a/NetlinkHandler.h b/server/NetlinkHandler.h similarity index 100% rename from NetlinkHandler.h rename to server/NetlinkHandler.h diff --git a/NetlinkManager.cpp b/server/NetlinkManager.cpp similarity index 100% rename from NetlinkManager.cpp rename to server/NetlinkManager.cpp diff --git a/NetlinkManager.h b/server/NetlinkManager.h similarity index 100% rename from NetlinkManager.h rename to server/NetlinkManager.h diff --git a/NetworkController.cpp b/server/NetworkController.cpp similarity index 100% rename from NetworkController.cpp rename to server/NetworkController.cpp diff --git a/NetworkController.h b/server/NetworkController.h similarity index 100% rename from NetworkController.h rename to server/NetworkController.h diff --git a/Permission.cpp b/server/Permission.cpp similarity index 100% rename from Permission.cpp rename to server/Permission.cpp diff --git a/Permission.h b/server/Permission.h similarity index 94% rename from Permission.h rename to server/Permission.h index 8cb6b8f..38f946b 100644 --- a/Permission.h +++ b/server/Permission.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SYSTEM_NETD_PERMISSION_H -#define SYSTEM_NETD_PERMISSION_H +#ifndef NETD_SERVER_PERMISSION_H +#define NETD_SERVER_PERMISSION_H // This enum represents the permissions we care about for networking. When applied to an app, it's // the permission the app (UID) has been granted. When applied to a network, it's the permission an @@ -37,4 +37,4 @@ enum Permission { Permission permissionFromString(const char* permission); -#endif // SYSTEM_NETD_PERMISSION_H +#endif // NETD_SERVER_PERMISSION_H diff --git a/PermissionsController.cpp b/server/PermissionsController.cpp similarity index 100% rename from PermissionsController.cpp rename to server/PermissionsController.cpp diff --git a/PermissionsController.h b/server/PermissionsController.h similarity index 89% rename from PermissionsController.h rename to server/PermissionsController.h index 29ae731..e259e6d 100644 --- a/PermissionsController.h +++ b/server/PermissionsController.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SYSTEM_NETD_PERMISSIONS_CONTROLLER_H -#define SYSTEM_NETD_PERMISSIONS_CONTROLLER_H +#ifndef NETD_SERVER_PERMISSIONS_CONTROLLER_H +#define NETD_SERVER_PERMISSIONS_CONTROLLER_H #include "Permission.h" @@ -36,4 +36,4 @@ private: std::map mNetworks; }; -#endif // SYSTEM_NETD_PERMISSIONS_CONTROLLER_H +#endif // NETD_SERVER_PERMISSIONS_CONTROLLER_H diff --git a/PppController.cpp b/server/PppController.cpp similarity index 100% rename from PppController.cpp rename to server/PppController.cpp diff --git a/PppController.h b/server/PppController.h similarity index 100% rename from PppController.h rename to server/PppController.h diff --git a/ResolverController.cpp b/server/ResolverController.cpp similarity index 100% rename from ResolverController.cpp rename to server/ResolverController.cpp diff --git a/ResolverController.h b/server/ResolverController.h similarity index 100% rename from ResolverController.h rename to server/ResolverController.h diff --git a/ResponseCode.h b/server/ResponseCode.h similarity index 100% rename from ResponseCode.h rename to server/ResponseCode.h diff --git a/RouteController.cpp b/server/RouteController.cpp similarity index 100% rename from RouteController.cpp rename to server/RouteController.cpp diff --git a/RouteController.h b/server/RouteController.h similarity index 92% rename from RouteController.h rename to server/RouteController.h index 77b7eea..2769a31 100644 --- a/RouteController.h +++ b/server/RouteController.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SYSTEM_NETD_ROUTE_CONTROLLER_H -#define SYSTEM_NETD_ROUTE_CONTROLLER_H +#ifndef NETD_SERVER_ROUTE_CONTROLLER_H +#define NETD_SERVER_ROUTE_CONTROLLER_H #include "Permission.h" @@ -38,4 +38,4 @@ public: static bool removeRoute(const char* interface, const char* destination, const char* nexthop); }; -#endif // SYSTEM_NETD_ROUTE_CONTROLLER_H +#endif // NETD_SERVER_ROUTE_CONTROLLER_H diff --git a/SecondaryTableController.cpp b/server/SecondaryTableController.cpp similarity index 100% rename from SecondaryTableController.cpp rename to server/SecondaryTableController.cpp diff --git a/SecondaryTableController.h b/server/SecondaryTableController.h similarity index 100% rename from SecondaryTableController.h rename to server/SecondaryTableController.h diff --git a/SoftapController.cpp b/server/SoftapController.cpp similarity index 100% rename from SoftapController.cpp rename to server/SoftapController.cpp diff --git a/SoftapController.h b/server/SoftapController.h similarity index 100% rename from SoftapController.h rename to server/SoftapController.h diff --git a/TetherController.cpp b/server/TetherController.cpp similarity index 100% rename from TetherController.cpp rename to server/TetherController.cpp diff --git a/TetherController.h b/server/TetherController.h similarity index 100% rename from TetherController.h rename to server/TetherController.h diff --git a/main.cpp b/server/main.cpp similarity index 100% rename from main.cpp rename to server/main.cpp diff --git a/ndc.c b/server/ndc.c similarity index 100% rename from ndc.c rename to server/ndc.c diff --git a/oem_iptables_hook.cpp b/server/oem_iptables_hook.cpp similarity index 100% rename from oem_iptables_hook.cpp rename to server/oem_iptables_hook.cpp diff --git a/oem_iptables_hook.h b/server/oem_iptables_hook.h similarity index 100% rename from oem_iptables_hook.h rename to server/oem_iptables_hook.h -- 2.11.0