53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
/*
|
||
* eth_ip.hpp
|
||
*
|
||
* Created on: 13 <20><><EFBFBD>. 2023 <20>.
|
||
* Author: sychev
|
||
*/
|
||
|
||
#ifndef FREE_RTOS_ETHERNET_IP_ETH_IP_HPP_
|
||
#define FREE_RTOS_ETHERNET_IP_ETH_IP_HPP_
|
||
|
||
#include "free_rtos/handler_store/handler_store.hpp"
|
||
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
|
||
#include "free_rtos/ethernet/eth_frame.h"
|
||
#include "free_rtos/ethernet_ip/eth_arp_iface.hpp"
|
||
#include "free_rtos/ethernet_ip/eth_ip_iface.hpp"
|
||
|
||
#include <cstdint>
|
||
|
||
namespace free_rtos {
|
||
|
||
class EthIp : public Handler, public EthIpIface {
|
||
public:
|
||
EthIp(EthStackIface& eth_stack, EthArpIface& arp);
|
||
|
||
void setSelfIpAddr(uint32_t ip) {self_ip_ = ip;};
|
||
|
||
virtual uint32_t getSelfIpAddr() override {return self_ip_;};
|
||
|
||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||
|
||
virtual uint32_t Sender(uint8_t * p_data, size_t scatter_segment) override;
|
||
|
||
virtual bool send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot_id, TEthPkt& pkt) override;
|
||
|
||
bool Register(uint8_t prot_id, Handler * p_handler);
|
||
|
||
private:
|
||
HandlerStore handlers_;
|
||
|
||
EthStackIface& eth_stack_;
|
||
EthArpIface& arp_;
|
||
|
||
uint16_t ip_indet_; /// <20><><EFBFBD><EFBFBD> ip_id
|
||
|
||
uint32_t self_ip_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ip-<2D><><EFBFBD><EFBFBD><EFBFBD>
|
||
};
|
||
|
||
}
|
||
|
||
|
||
|
||
#endif /* FREE_RTOS_ETHERNET_IP_ETH_IP_HPP_ */
|