2023-05-03 14:01:32 +03:00
|
|
|
|
/*
|
|
|
|
|
|
* eth_udp.hpp
|
|
|
|
|
|
*
|
2023-06-08 12:27:49 +03:00
|
|
|
|
* Created on: 15 <EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
|
2023-05-03 14:01:32 +03:00
|
|
|
|
* Author: sychev
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_
|
|
|
|
|
|
#define FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_
|
|
|
|
|
|
|
2023-10-18 15:29:31 +03:00
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
|
|
#include <networking/enet/utils/include/enet_apputils.h>
|
|
|
|
|
|
|
2023-06-26 18:22:30 +03:00
|
|
|
|
#include "free_rtos/handler_store/handler_store.hpp"
|
|
|
|
|
|
#include "free_rtos/ethernet_ip/eth_udp_server_iface.hpp"
|
|
|
|
|
|
#include "free_rtos/ethernet_ip/eth_ip_iface.hpp"
|
|
|
|
|
|
#include "free_rtos/ethernet/eth_types.h"
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
namespace free_rtos {
|
|
|
|
|
|
|
|
|
|
|
|
class EthUdpServer : public Handler, public EthUdpServerIface {
|
|
|
|
|
|
public:
|
|
|
|
|
|
EthUdpServer(EthIpIface& ip_iface);
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2023-10-24 14:02:04 +03:00
|
|
|
|
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
2023-06-08 12:27:49 +03:00
|
|
|
|
|
2023-07-17 18:06:31 +03:00
|
|
|
|
virtual int32_t select(uint32_t ticks = SystemP_WAIT_FOREVER) override
|
2023-07-17 17:51:18 +03:00
|
|
|
|
{
|
2023-10-11 10:23:04 +03:00
|
|
|
|
int32_t sts;
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
sts = rx_sem_.pend(ticks);
|
|
|
|
|
|
} while(sts != SystemP_SUCCESS);
|
|
|
|
|
|
|
|
|
|
|
|
return sts;
|
2023-07-17 17:51:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-05-03 14:01:32 +03:00
|
|
|
|
private:
|
|
|
|
|
|
EthIpIface& ip_iface_;
|
|
|
|
|
|
|
|
|
|
|
|
TEthMacPorts port_id_;
|
|
|
|
|
|
|
2023-06-08 12:27:49 +03:00
|
|
|
|
std::map<uint16_t, std::shared_ptr<EthUpdClient>> connections_; /// <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2023-07-17 17:51:18 +03:00
|
|
|
|
Semaphore rx_sem_;
|
2023-06-08 12:27:49 +03:00
|
|
|
|
///HandlerStore handlers_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> udp-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-05-03 14:01:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FREE_RTOS_ETHERNET_IP_ETH_UDP_SERVER_HPP_ */
|