2023-05-03 14:01:32 +03:00
|
|
|
|
/*
|
|
|
|
|
|
* eth_ip_iface.hpp
|
|
|
|
|
|
*
|
2024-02-21 10:41:56 +03:00
|
|
|
|
* Created on: 15 мар. 2023 г.
|
2023-05-03 14:01:32 +03:00
|
|
|
|
* Author: sychev
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FREE_RTOS_ETHERNET_IP_ETH_IP_IFACE_HPP_
|
|
|
|
|
|
#define FREE_RTOS_ETHERNET_IP_ETH_IP_IFACE_HPP_
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
2023-06-26 18:22:30 +03:00
|
|
|
|
#include "free_rtos/ethernet/eth_types.h"
|
|
|
|
|
|
#include "free_rtos/ethernet/eth_frame.h"
|
2023-10-26 10:21:41 +03:00
|
|
|
|
#include "free_rtos/ethernet_ip/eth_ip_types.h"
|
2023-10-24 14:02:04 +03:00
|
|
|
|
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
struct IpHandlerArgs : public EthStackHandlerArgs {
|
2023-10-26 10:21:41 +03:00
|
|
|
|
uint16_t ip_header_len;
|
|
|
|
|
|
uint16_t ip_data_len;
|
2023-10-24 14:02:04 +03:00
|
|
|
|
uint32_t dest_ip;
|
2023-10-26 13:47:28 +03:00
|
|
|
|
uint64_t dest_mac;
|
2023-10-24 14:02:04 +03:00
|
|
|
|
uint8_t ip_prot_id;
|
|
|
|
|
|
Handler* ip_handler;
|
|
|
|
|
|
};
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
class EthIpIface {
|
|
|
|
|
|
public:
|
|
|
|
|
|
/**
|
2024-02-21 10:41:56 +03:00
|
|
|
|
* Передача пакета
|
2023-05-03 14:01:32 +03:00
|
|
|
|
*/
|
|
|
|
|
|
virtual bool send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot_id, TEthPkt& pkt) = 0;
|
2023-10-24 14:02:04 +03:00
|
|
|
|
virtual bool send(IpHandlerArgs& handlerArgs) = 0;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
virtual uint32_t getSelfIpAddr() = 0;
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~EthIpIface() {};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FREE_RTOS_ETHERNET_IP_ETH_IP_IFACE_HPP_ */
|