Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios/networking] - added seperate network implemenation for ios (stri…
…pped out of NetworkLinux and adapted for ios)
- Loading branch information
Showing
11 changed files
with
733 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(SOURCES NetworkIOS.mm) | ||
|
||
set(HEADERS NetworkIOS.h | ||
route.h) | ||
|
||
core_add_library(platform_ios_network) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (C) 2005-2018 Team Kodi | ||
* This file is part of Kodi - https://kodi.tv | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* See LICENSES/README.md for more information. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "network/Network.h" | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
class CNetworkIOS; | ||
|
||
class CNetworkInterfaceIOS : public CNetworkInterface | ||
{ | ||
public: | ||
CNetworkInterfaceIOS(CNetworkIOS* network, std::string interfaceName); | ||
~CNetworkInterfaceIOS() override; | ||
|
||
bool IsEnabled() const override; | ||
bool IsConnected() const override; | ||
|
||
std::string GetMacAddress() const override; | ||
void GetMacAddressRaw(char rawMac[6]) const override; | ||
|
||
bool GetHostMacAddress(unsigned long host, std::string& mac) const override; | ||
|
||
std::string GetCurrentIPAddress() const override; | ||
std::string GetCurrentNetmask() const override; | ||
std::string GetCurrentDefaultGateway() const override; | ||
|
||
std::string GetInterfaceName() const; | ||
|
||
private: | ||
std::string m_interfaceName; | ||
CNetworkIOS* m_network; | ||
}; | ||
|
||
class CNetworkIOS : public CNetworkBase | ||
{ | ||
public: | ||
CNetworkIOS(); | ||
~CNetworkIOS() override; | ||
|
||
// Return the list of interfaces | ||
std::vector<CNetworkInterface*>& GetInterfaceList() override; | ||
CNetworkInterface* GetFirstConnectedInterface() override; | ||
|
||
// Ping remote host | ||
bool PingHost(unsigned long host, unsigned int timeout_ms = 2000) override; | ||
|
||
// Get/set the nameserver(s) | ||
std::vector<std::string> GetNameServers() override; | ||
|
||
friend class CNetworkInterfaceIOS; | ||
|
||
private: | ||
int GetSocket() { return m_sock; } | ||
void queryInterfaceList(); | ||
std::vector<CNetworkInterface*> m_interfaces; | ||
int m_sock; | ||
}; | ||
|
||
using CNetwork = CNetworkIOS; |
Oops, something went wrong.