source: flair-src/trunk/lib/FlairCore/src/unexported/Socket_impl.h @ 2

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 6 years ago

flaircore

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