Last change
on this file since 197 was 15, checked in by Bayard Gildas, 8 years ago |
sources reformatted with flair-format-dir script
|
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 Socket_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 SOCKET_IMPL_H
|
---|
14 | #define SOCKET_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 {
|
---|
24 | namespace core {
|
---|
25 | class Socket;
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | class Socket_impl {
|
---|
30 | public:
|
---|
31 | Socket_impl(const flair::core::Socket *self, std::string name,
|
---|
32 | std::string address, bool broadcast = false);
|
---|
33 | Socket_impl(const flair::core::Socket *self, std::string name, uint16_t port);
|
---|
34 | ~Socket_impl();
|
---|
35 |
|
---|
36 | void SendMessage(std::string message);
|
---|
37 | void SendMessage(const char *src, size_t src_len);
|
---|
38 | ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
|
---|
39 | char *src = NULL, size_t *src_len = NULL);
|
---|
40 |
|
---|
41 | private:
|
---|
42 | int fd;
|
---|
43 | uint16_t port;
|
---|
44 | std::string address;
|
---|
45 | bool broadcast;
|
---|
46 | void Init(void);
|
---|
47 | const flair::core::Socket *self;
|
---|
48 | struct sockaddr_in sock_in;
|
---|
49 | #ifdef __XENO__
|
---|
50 | bool is_running;
|
---|
51 | static void *user(void *arg);
|
---|
52 | pthread_t user_thread;
|
---|
53 | RT_PIPE pipe;
|
---|
54 | #endif
|
---|
55 | };
|
---|
56 |
|
---|
57 | #endif // SOCKET_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.