mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 11:51:45 +08:00
Unified EoE IP parameter names.
This commit is contained in:
@@ -1821,7 +1821,7 @@ EC_PUBLIC_API int ecrt_slave_config_flag(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_link(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_mac_address(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
const unsigned char *mac_address /**< MAC address. */
|
||||
);
|
||||
@@ -1834,7 +1834,7 @@ EC_PUBLIC_API int ecrt_slave_config_eoe_link(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_addr(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_ip_address(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint32_t ip_address /**< IPv4 address. */
|
||||
);
|
||||
@@ -1847,7 +1847,7 @@ EC_PUBLIC_API int ecrt_slave_config_eoe_addr(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_subnet(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_subnet_mask(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint32_t subnet_mask /**< IPv4 subnet mask. */
|
||||
);
|
||||
@@ -1860,7 +1860,7 @@ EC_PUBLIC_API int ecrt_slave_config_eoe_subnet(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_default(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_default_gateway(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint32_t gateway_address /**< Gateway's IPv4 address. */
|
||||
);
|
||||
@@ -1873,7 +1873,7 @@ EC_PUBLIC_API int ecrt_slave_config_eoe_default(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_dns(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_dns_address(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
uint32_t dns_address /**< IPv4 address of the DNS server. */
|
||||
);
|
||||
@@ -1886,7 +1886,7 @@ EC_PUBLIC_API int ecrt_slave_config_eoe_dns(
|
||||
* \retval 0 Success.
|
||||
* \retval <0 Error code.
|
||||
*/
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_name(
|
||||
EC_PUBLIC_API int ecrt_slave_config_eoe_hostname(
|
||||
ec_slave_config_t *sc, /**< Slave configuration. */
|
||||
const unsigned char *name /**< Zero-terminated hostname. */
|
||||
);
|
||||
|
||||
@@ -44,7 +44,11 @@ noinst_HEADERS = \
|
||||
soe_request.h \
|
||||
voe_handler.h
|
||||
|
||||
libethercat_la_CFLAGS = -fno-strict-aliasing -Wall -I$(top_srcdir) \
|
||||
libethercat_la_CFLAGS = \
|
||||
-fno-strict-aliasing \
|
||||
-Wall \
|
||||
-Wmissing-prototypes \
|
||||
-I$(top_srcdir) \
|
||||
-Dethercat_EXPORTS \
|
||||
-fvisibility=hidden
|
||||
|
||||
|
||||
@@ -34,6 +34,13 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
// prototypes for internal lethods (avoid -Wmissing-prototype warning)
|
||||
void ec_master_clear_config(ec_master_t *);
|
||||
void ec_master_add_domain(ec_master_t *, ec_domain_t *);
|
||||
void ec_master_add_slave_config(ec_master_t *, ec_slave_config_t *);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_master_reserve(ec_master_t *master)
|
||||
{
|
||||
int ret = ioctl(master->fd, EC_IOCTL_REQUEST, NULL);
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
// prototypes for internal lethods (avoid -Wmissing-prototype warning)
|
||||
void ec_slave_config_add_sdo_request(ec_slave_config_t *, ec_sdo_request_t *);
|
||||
void ec_slave_config_add_reg_request(ec_slave_config_t *, ec_reg_request_t *);
|
||||
void ec_slave_config_add_voe_handler(ec_slave_config_t *, ec_voe_handler_t *);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void ec_slave_config_clear(ec_slave_config_t *sc)
|
||||
{
|
||||
ec_sdo_request_t *r, *next_r;
|
||||
@@ -612,7 +619,7 @@ ec_sdo_request_t *ecrt_slave_config_create_sdo_request(ec_slave_config_t *sc,
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void ec_slave_config_add_soe_request(ec_slave_config_t *sc,
|
||||
inline void ec_slave_config_add_soe_request(ec_slave_config_t *sc,
|
||||
ec_soe_request_t *req)
|
||||
{
|
||||
if (sc->first_soe_request) {
|
||||
@@ -892,7 +899,7 @@ int ecrt_slave_config_flag(ec_slave_config_t *sc, const char *key,
|
||||
|
||||
#ifdef EC_EOE
|
||||
|
||||
int ecrt_slave_config_eoe_link(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_mac_address(ec_slave_config_t *sc,
|
||||
const unsigned char *mac_address)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
@@ -914,7 +921,8 @@ int ecrt_slave_config_eoe_link(ec_slave_config_t *sc,
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_addr(ec_slave_config_t *sc, uint32_t ip_address)
|
||||
int ecrt_slave_config_eoe_ip_address(ec_slave_config_t *sc,
|
||||
uint32_t ip_address)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
int ret;
|
||||
@@ -935,7 +943,8 @@ int ecrt_slave_config_eoe_addr(ec_slave_config_t *sc, uint32_t ip_address)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_subnet(ec_slave_config_t *sc, uint32_t subnet_mask)
|
||||
int ecrt_slave_config_eoe_subnet_mask(ec_slave_config_t *sc,
|
||||
uint32_t subnet_mask)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
int ret;
|
||||
@@ -956,7 +965,7 @@ int ecrt_slave_config_eoe_subnet(ec_slave_config_t *sc, uint32_t subnet_mask)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_default(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_default_gateway(ec_slave_config_t *sc,
|
||||
uint32_t gateway_address)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
@@ -978,7 +987,8 @@ int ecrt_slave_config_eoe_default(ec_slave_config_t *sc,
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_dns(ec_slave_config_t *sc, uint32_t dns_address)
|
||||
int ecrt_slave_config_eoe_dns_address(ec_slave_config_t *sc,
|
||||
uint32_t dns_address)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
int ret;
|
||||
@@ -999,7 +1009,7 @@ int ecrt_slave_config_eoe_dns(ec_slave_config_t *sc, uint32_t dns_address)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_name(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_hostname(ec_slave_config_t *sc,
|
||||
const unsigned char *name)
|
||||
{
|
||||
ec_ioctl_eoe_ip_t io = {};
|
||||
|
||||
@@ -3343,22 +3343,22 @@ static ATTRIBUTES int ec_ioctl_sc_ip(
|
||||
|
||||
/* the kernel versions of the EoE set IP methods never fail. */
|
||||
if (io.mac_address_included) {
|
||||
ecrt_slave_config_eoe_link(sc, io.mac_address);
|
||||
ecrt_slave_config_eoe_mac_address(sc, io.mac_address);
|
||||
}
|
||||
if (io.ip_address_included) {
|
||||
ecrt_slave_config_eoe_addr(sc, io.ip_address);
|
||||
ecrt_slave_config_eoe_ip_address(sc, io.ip_address);
|
||||
}
|
||||
if (io.subnet_mask_included) {
|
||||
ecrt_slave_config_eoe_subnet(sc, io.subnet_mask);
|
||||
ecrt_slave_config_eoe_subnet_mask(sc, io.subnet_mask);
|
||||
}
|
||||
if (io.gateway_included) {
|
||||
ecrt_slave_config_eoe_default(sc, io.gateway);
|
||||
ecrt_slave_config_eoe_default_gateway(sc, io.gateway);
|
||||
}
|
||||
if (io.dns_included) {
|
||||
ecrt_slave_config_eoe_dns(sc, io.dns);
|
||||
ecrt_slave_config_eoe_dns_address(sc, io.dns);
|
||||
}
|
||||
if (io.name_included) {
|
||||
ecrt_slave_config_eoe_name(sc, io.name);
|
||||
ecrt_slave_config_eoe_hostname(sc, io.name);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1436,7 +1436,7 @@ int ecrt_slave_config_flag(ec_slave_config_t *sc, const char *key,
|
||||
|
||||
#ifdef EC_EOE
|
||||
|
||||
int ecrt_slave_config_eoe_link(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_mac_address(ec_slave_config_t *sc,
|
||||
const unsigned char *mac_address)
|
||||
{
|
||||
memcpy(sc->eoe_ip_param_request.mac_address, mac_address, EC_ETH_ALEN);
|
||||
@@ -1446,7 +1446,8 @@ int ecrt_slave_config_eoe_link(ec_slave_config_t *sc,
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_addr(ec_slave_config_t *sc, uint32_t ip_address)
|
||||
int ecrt_slave_config_eoe_ip_address(ec_slave_config_t *sc,
|
||||
uint32_t ip_address)
|
||||
{
|
||||
sc->eoe_ip_param_request.ip_address = ip_address;
|
||||
sc->eoe_ip_param_request.ip_address_included = 1;
|
||||
@@ -1455,7 +1456,8 @@ int ecrt_slave_config_eoe_addr(ec_slave_config_t *sc, uint32_t ip_address)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_subnet(ec_slave_config_t *sc, uint32_t subnet_mask)
|
||||
int ecrt_slave_config_eoe_subnet_mask(ec_slave_config_t *sc,
|
||||
uint32_t subnet_mask)
|
||||
{
|
||||
sc->eoe_ip_param_request.subnet_mask = subnet_mask;
|
||||
sc->eoe_ip_param_request.subnet_mask_included = 1;
|
||||
@@ -1464,7 +1466,7 @@ int ecrt_slave_config_eoe_subnet(ec_slave_config_t *sc, uint32_t subnet_mask)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_default(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_default_gateway(ec_slave_config_t *sc,
|
||||
uint32_t gateway_address)
|
||||
{
|
||||
sc->eoe_ip_param_request.gateway = gateway_address;
|
||||
@@ -1474,7 +1476,8 @@ int ecrt_slave_config_eoe_default(ec_slave_config_t *sc,
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_dns(ec_slave_config_t *sc, uint32_t dns_address)
|
||||
int ecrt_slave_config_eoe_dns_address(ec_slave_config_t *sc,
|
||||
uint32_t dns_address)
|
||||
{
|
||||
sc->eoe_ip_param_request.dns = dns_address;
|
||||
sc->eoe_ip_param_request.dns_included = 1;
|
||||
@@ -1483,7 +1486,7 @@ int ecrt_slave_config_eoe_dns(ec_slave_config_t *sc, uint32_t dns_address)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int ecrt_slave_config_eoe_name(ec_slave_config_t *sc,
|
||||
int ecrt_slave_config_eoe_hostname(ec_slave_config_t *sc,
|
||||
const unsigned char *name)
|
||||
{
|
||||
strncpy(sc->eoe_ip_param_request.name, name, EC_MAX_HOSTNAME_SIZE);
|
||||
@@ -1524,12 +1527,12 @@ EXPORT_SYMBOL(ecrt_slave_config_state);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_idn);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_flag);
|
||||
#ifdef EOE
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_link);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_addr);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_subnet);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_default);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_dns);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_name);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_mac_address);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_ip_address);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_subnet_mask);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_default_gateway);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_dns_address);
|
||||
EXPORT_SYMBOL(ecrt_slave_config_eoe_hostname);
|
||||
#endif
|
||||
|
||||
/** \endcond */
|
||||
|
||||
@@ -53,13 +53,14 @@ string CommandIp::helpString(const string &binaryBaseName) const
|
||||
<< endl
|
||||
<< "IP parameters can be appended as argument pairs:" << endl
|
||||
<< endl
|
||||
<< " addr <IPv4>[/prefix] IP address (optionally with" << endl
|
||||
<< " decimal subnet prefix)" << endl
|
||||
<< " link <MAC> Link-layer address (may contain" << endl
|
||||
<< " colons or hyphens)" << endl
|
||||
<< " default <IPv4> Default gateway" << endl
|
||||
<< " dns <IPv4> DNS server" << endl
|
||||
<< " name <hostname> Host name (max. 32 byte)" << endl
|
||||
<< " ip_address <IPv4>[/prefix] IP address (optionally with" << endl
|
||||
<< " decimal subnet prefix)" << endl
|
||||
<< " mac_address <MAC> Link-layer address (may contain"
|
||||
<< endl
|
||||
<< " colons or hyphens)" << endl
|
||||
<< " default_gateway <IPv4> Default gateway" << endl
|
||||
<< " dns_address <IPv4> DNS server address" << endl
|
||||
<< " hostname <hostname> Host name (max. 32 byte)" << endl
|
||||
<< endl
|
||||
<< "IPv4 adresses can be given either in dot notation or as" << endl
|
||||
<< "hostnames, which will be automatically resolved." << endl
|
||||
@@ -95,23 +96,23 @@ void CommandIp::execute(const StringVector &args)
|
||||
string val = args[argIdx + 1];
|
||||
std::transform(arg.begin(), arg.end(), arg.begin(), ::tolower);
|
||||
|
||||
if (arg == "link") {
|
||||
if (arg == "link" or arg == "mac_address") {
|
||||
parseMac(io.mac_address, val);
|
||||
io.mac_address_included = 1;
|
||||
}
|
||||
else if (arg == "addr") {
|
||||
else if (arg == "addr" or arg == "ip_address") {
|
||||
parseIpv4Prefix(&io, val);
|
||||
io.ip_address_included = 1;
|
||||
}
|
||||
else if (arg == "default") {
|
||||
else if (arg == "default" or arg == "default_gateway") {
|
||||
resolveIpv4(&io.gateway, val);
|
||||
io.gateway_included = 1;
|
||||
}
|
||||
else if (arg == "dns") {
|
||||
else if (arg == "dns" or arg == "dns_adress") {
|
||||
resolveIpv4(&io.dns, val);
|
||||
io.dns_included = 1;
|
||||
}
|
||||
else if (arg == "name") {
|
||||
else if (arg == "name" or arg == "hostname") {
|
||||
if (val.size() > EC_MAX_HOSTNAME_SIZE - 1) {
|
||||
stringstream err;
|
||||
err << "Name too long!";
|
||||
|
||||
Reference in New Issue
Block a user