61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
// SPDX-License-Identifier: MIT
|
|
/**
|
|
Copyright (c) 2020 - 2022 Beckhoff Automation GmbH & Co. KG
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#if defined(USE_TWINCAT_ROUTER)
|
|
#include "TwinCAT/AdsLib.h"
|
|
#else
|
|
#include "Standalone/AdsLib.h"
|
|
#endif
|
|
|
|
#include "Sockets.h"
|
|
|
|
namespace Beckhoff
|
|
{
|
|
namespace Ads
|
|
{
|
|
enum UdpTag : uint16_t {
|
|
PASSWORD = 2,
|
|
COMPUTERNAME = 5,
|
|
NETID = 7,
|
|
ROUTENAME = 12,
|
|
USERNAME = 13,
|
|
};
|
|
|
|
enum UdpServiceId : uint32_t {
|
|
SERVERINFO = 1,
|
|
ADDROUTE = 6,
|
|
RESPONSE = 0x80000000,
|
|
};
|
|
|
|
/**
|
|
* Add an ADS route to a remote TwinCAT system
|
|
* @param[in] remote hostname or ip address of the remote TwinCAT system
|
|
* @param[in] destNetId AmsNetId of the routes destination
|
|
* @param[in] destAddr hostname or ip address of the routes destination
|
|
* @param[in] routeName name of the new route
|
|
* @param[in] remoteUsername username on the remote TwinCAT system
|
|
* @param[in] remotePassword password for the user on the remote TwinCAT system
|
|
* @return [ADS Return Code](https://infosys.beckhoff.com/content/1031/tcadscommon/html/ads_returncodes.htm?id=1666172286265530469)
|
|
*/
|
|
long AddRemoteRoute(const std::string& remote,
|
|
AmsNetId destNetId,
|
|
const std::string& destAddr,
|
|
const std::string& routeName,
|
|
const std::string& remoteUsername,
|
|
const std::string& remotePassword);
|
|
|
|
/**
|
|
* Read AmsNetId of some TwinCAT remote host
|
|
* @param[in] remote hostname or ip address of the remote TwinCAT system
|
|
* @param[out] netId on success the AmsNetId of the remote TwinCAT system is written here
|
|
* @return [ADS Return Code](https://infosys.beckhoff.com/content/1031/tcadscommon/html/ads_returncodes.htm?id=1666172286265530469)
|
|
*/
|
|
long GetRemoteAddress(const std::string& remote,
|
|
AmsNetId& netId);
|
|
}
|
|
}
|