Rev | Line | |
---|
[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] | 23 | namespace flair { namespace core {
|
---|
| 24 | class UdpSocket;
|
---|
| 25 | } }
|
---|
[2] | 26 |
|
---|
[178] | 27 | class UdpSocket_impl {
|
---|
[15] | 28 | public:
|
---|
[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 |
|
---|
[15] | 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);
|
---|
[2] | 38 |
|
---|
[15] | 39 | private:
|
---|
| 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;
|
---|
[15] | 46 | struct sockaddr_in sock_in;
|
---|
[2] | 47 | #ifdef __XENO__
|
---|
[15] | 48 | bool is_running;
|
---|
| 49 | static void *user(void *arg);
|
---|
| 50 | pthread_t user_thread;
|
---|
| 51 | RT_PIPE pipe;
|
---|
[2] | 52 | #endif
|
---|
| 53 | };
|
---|
| 54 |
|
---|
[178] | 55 | #endif // UDPSOCKET_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.