Last change
on this file since 363 was 363, checked in by Sanahuja Guillaume, 4 years ago |
allow mutliple connection on udp (only nrt for the moment)
|
File size:
1.4 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 |
|
---|
23 | namespace flair { namespace core {
|
---|
24 | class UdpSocket;
|
---|
25 | } }
|
---|
26 |
|
---|
27 | class UdpSocket_impl {
|
---|
28 | public:
|
---|
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 *msg, size_t msg_len,int dst_id);
|
---|
36 | ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
|
---|
37 | char *src = NULL, size_t *src_len = NULL,int *src_id=NULL);
|
---|
38 |
|
---|
39 | private:
|
---|
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 | size_t sock_in_size;
|
---|
48 | #ifdef __XENO__
|
---|
49 | bool is_running;
|
---|
50 | static void *user(void *arg);
|
---|
51 | pthread_t user_thread;
|
---|
52 | RT_PIPE pipe;
|
---|
53 | #endif
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif // UDPSOCKET_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.