16 #include <sys/types.h>
21 #include <sys/socket.h>
22 #include <arpa/inet.h>
26 #define DEBUG_PRINT(x,...)
36 const char *
const compName
37 ) : UdpReceiverComponentBase(compName),
54 UdpReceiverComponentBase::init(instance);
60 if (this->
m_fd != -1) {
70 this->
m_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
71 if (-1 == this->
m_fd) {
73 this->log_WARNING_HI_UR_SocketError(arg);
78 memset((
char *) &saddr, 0,
sizeof(saddr));
80 saddr.sin_family = AF_INET;
81 saddr.sin_port = htons(atoi(port));
82 saddr.sin_addr.s_addr = htonl(INADDR_ANY);
88 this->log_WARNING_HI_UR_BindError(arg);
92 this->log_ACTIVITY_HI_UR_PortOpened(atoi(port));
118 void UdpReceiverComponentImpl ::
142 this->m_recvBuff.getBuffCapacity(),
147 if (errno != EINTR) {
149 this->log_WARNING_HI_UR_RecvError(arg);
162 this->log_WARNING_HI_UR_DecodeError(DECODE_SEQ,stat);
179 this->log_WARNING_HI_UR_DroppedPacket(diff);
181 this->m_currSeq = seqNum;
190 this->log_WARNING_HI_UR_DecodeError(DECODE_PORT,stat);
198 this->log_WARNING_HI_UR_DecodeError(DECODE_BUFFER,stat);
205 if (this->isConnected_PortsOut_OutputPort(portNum)) {
212 this->log_WARNING_HI_UR_DecodeError(PORT_SEND,stat);
228 UdpReceiverComponentImpl::UdpSerialBuffer::UdpSerialBuffer(
235 UdpReceiverComponentImpl::UdpSerialBuffer::UdpSerialBuffer(
236 const UdpReceiverComponentImpl::UdpSerialBuffer& other) :
Fw::SerializeBufferBase() {
237 FW_ASSERT(
sizeof(this->m_buff)>= other.getBuffLength(),
sizeof(this->m_buff),other.getBuffLength());
238 memcpy(this->m_buff,other.m_buff,other.getBuffLength());
239 this->setBuffLen(other.getBuffLength());
242 UdpReceiverComponentImpl::UdpSerialBuffer::UdpSerialBuffer():
Fw::SerializeBufferBase() {