libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
veth.h
1
13/*
14 * This file is part of libethercat.
15 *
16 * libethercat is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 3 of the License, or (at your option) any later version.
20 *
21 * libethercat is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with libethercat (LICENSE.LGPL-V3); if not, write
28 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
29 * Floor, Boston, MA 02110-1301, USA.
30 *
31 * Please note that the use of the EtherCAT technology, the EtherCAT
32 * brand name and the EtherCAT logo is only permitted if the property
33 * rights of Beckhoff Automation GmbH are observed. For further
34 * information please contact Beckhoff Automation GmbH & Co. KG,
35 * Hülshorstweg 20, D-33415 Verl, Germany (www.beckhoff.com) or the
36 * EtherCAT Technology Group, Ostendstraße 196, D-90482 Nuremberg,
37 * Germany (ETG, www.ethercat.org).
38 *
39 */
40
41#ifndef LIBETHERCAT_VETH_H
42#define LIBETHERCAT_VETH_H
43
44#include "libosal/types.h"
45#include "libosal/task.h"
46#include "libethercat/pool.h"
47
48#define EC_VETH_ETH_ALEN 6
49
50typedef struct ec_veth {
51 int fd;
52 osal_uint32_t ip;
53 osal_uint8_t mac[EC_VETH_ETH_ALEN];
54 osal_task_t tid;
55 osal_bool_t running;
56} ec_veth_t;
57
58typedef struct eth_frame {
59 osal_size_t frame_size;
60 osal_uint8_t frame_data[1518];
62
63// forward declarations
64struct ec;
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
80int ec_veth_open_tun(
81 struct ec *pec,
82 const char *tun_dev_name,
83 const uint8_t mac_addr[EC_VETH_ETH_ALEN],
84 const uint32_t ip_addr);
85
91void ec_veth_close_tun(struct ec *pec);
92
100void ec_veth_process_frame(struct ec *pec, uint8_t *buf, size_t len);
101
109int ec_veth_send_frame(struct ec *pec, uint8_t *buf, size_t len);
110
112
118void ec_mbx_gateway_enqueue(struct ec *pec, pool_entry_t *p_entry);
119
120#ifdef __cplusplus
121};
122#endif
123
124#endif // LIBETHERCAT_VETH_H
125
void ec_mbx_gateway_enqueue(struct ec *pec, struct pool_entry *p_entry)
Enqueue MBX Gateway message received from slave.
Data pool implementation.
Definition veth.h:50
osal_uint32_t ip
tun device ip addres
Definition veth.h:52
osal_task_t tid
tun device handler thread id.
Definition veth.h:54
osal_bool_t running
tun device handler run flag.
Definition veth.h:55
int fd
tun device file descriptor
Definition veth.h:51
ethercat master structure
Definition ec.h:197
Definition veth.h:58
Pool queue entry.
Definition pool.h:67