source: flair-src/trunk/lib/FlairCore/src/unexported/UdpSocket_impl.h@ 387

Last change on this file since 387 was 387, checked in by Sanahuja Guillaume, 17 months ago

resolve bug with udp broadcast

File size: 1.4 KB
RevLine 
[2]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]4// %flair:license}
5/*!
[178]6 * \file UdpSocket_impl.h
[2]7 * \brief Classe creant une socket
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2013/11/17
10 * \version 4.0
11 */
12
[178]13#ifndef UDPSOCKET_IMPL_H
14#define UDPSOCKET_IMPL_H
[2]15
16#include <sys/socket.h>
17#include <netdb.h>
18#include <Object.h>
19#ifdef __XENO__
20#include <native/pipe.h>
21#endif
22
[178]23namespace flair { namespace core {
24 class UdpSocket;
25} }
[2]26
[178]27class UdpSocket_impl {
[15]28public:
[178]29 UdpSocket_impl(const flair::core::UdpSocket *self, std::string name,
[15]30 std::string address, bool broadcast = false);
[178]31 UdpSocket_impl(const flair::core::UdpSocket *self, std::string name, uint16_t port);
32 ~UdpSocket_impl();
[2]33
[387]34 void SendMessage(std::string message,int dst_id);
[363]35 void SendMessage(const char *msg, size_t msg_len,int dst_id);
[15]36 ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
[363]37 char *src = NULL, size_t *src_len = NULL,int *src_id=NULL);
[2]38
[15]39private:
40 int fd;
41 uint16_t port;
42 std::string address;
43 bool broadcast;
44 void Init(void);
[178]45 const flair::core::UdpSocket *self;
[363]46 struct sockaddr_in *sock_in;
47 size_t sock_in_size;
[2]48#ifdef __XENO__
[15]49 bool is_running;
50 static void *user(void *arg);
51 pthread_t user_thread;
52 RT_PIPE pipe;
[2]53#endif
54};
55
[178]56#endif // UDPSOCKET_IMPL_H
Note: See TracBrowser for help on using the repository browser.