sitara_depot/components/free_rtos/ethernet_ip/eth_udp_server.hpp

62 lines
1.7 KiB
C++
Raw Permalink Normal View History

/*
* eth_udp.hpp
*
* Created on: 15 апр. 2023 г.
* Author: sychev
*/
#ifndef FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_
#define FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_
#include <map>
#include <networking/enet/utils/include/enet_apputils.h>
#include "free_rtos/handler_store/handler_store.hpp"
#include "free_rtos/ethernet_ip/eth_udp_server_iface.hpp"
2023-10-26 13:47:28 +03:00
#include "free_rtos/ethernet_ip/eth_arp_iface.hpp"
#include "free_rtos/ethernet_ip/eth_ip_iface.hpp"
#include "free_rtos/ethernet/eth_types.h"
namespace free_rtos {
class EthUdpServer : public Handler, public EthUdpServerIface {
public:
2023-10-26 13:47:28 +03:00
EthUdpServer(EthIpIface& ip_iface, EthArpIface& arp);
void setPortId(TEthMacPorts port_id) { port_id_ = port_id;};
virtual std::shared_ptr<EthUpdClient> createClient(uint16_t port_dst,
uint16_t port_src,
bool use_chksum) override;
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
virtual int32_t select(uint32_t ticks = SystemP_WAIT_FOREVER) override
{
int32_t sts;
do {
sts = rx_sem_.pend(ticks);
} while(sts != SystemP_SUCCESS);
return sts;
}
private:
EthIpIface& ip_iface_;
2023-10-26 13:47:28 +03:00
EthArpIface& arp_;
TEthMacPorts port_id_;
std::map<uint16_t, std::shared_ptr<EthUpdClient>> connections_; /// <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Semaphore rx_sem_;
///HandlerStore handlers_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> udp-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
};
}
#endif /* FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_ */