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

Last change on this file since 178 was 178, checked in by Bayard Gildas, 4 years ago

Change Udp socket object name (from "Socket" to "UdpSocket?")

File size: 1.3 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file UdpSocket_impl.h
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
13#ifndef UDPSOCKET_IMPL_H
14#define UDPSOCKET_IMPL_H
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
23namespace flair { namespace core {
24  class UdpSocket;
25} }
26
27class UdpSocket_impl {
28public:
29  UdpSocket_impl(const flair::core::UdpSocket *self, std::string name,
30              std::string address, bool broadcast = false);
31  UdpSocket_impl(const flair::core::UdpSocket *self, std::string name, uint16_t port);
32  ~UdpSocket_impl();
33
34  void SendMessage(std::string message);
35  void SendMessage(const char *src, size_t src_len);
36  ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
37                      char *src = NULL, size_t *src_len = NULL);
38
39private:
40  int fd;
41  uint16_t port;
42  std::string address;
43  bool broadcast;
44  void Init(void);
45  const flair::core::UdpSocket *self;
46  struct sockaddr_in sock_in;
47#ifdef __XENO__
48  bool is_running;
49  static void *user(void *arg);
50  pthread_t user_thread;
51  RT_PIPE pipe;
52#endif
53};
54
55#endif // UDPSOCKET_IMPL_H
Note: See TracBrowser for help on using the repository browser.