Line |
Branch |
Exec |
Source |
1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
#include "PEmptyBackend.h" |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
///Default constructor of PEmptyBackend |
11 |
|
✗ |
PEmptyBackend::PEmptyBackend(){ |
12 |
|
|
|
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
///Create param for a client socket |
16 |
|
|
/** @param address : address of the server to be connected to |
17 |
|
|
* @param port : port to be used |
18 |
|
|
* @return corresponding PZmqParam |
19 |
|
|
*/ |
20 |
|
19 |
PEmptyBackend::Param PEmptyBackend::client(const std::string & address, size_t port){ |
21 |
|
19 |
PEmptyBackend::Param param; |
22 |
1/1
✓ Branch 1 taken 19 times.
|
19 |
param.address = address; |
23 |
|
19 |
param.port = port; |
24 |
|
19 |
return param; |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
///Create param for a server socket |
28 |
|
|
/** @param address : address of the server to be connected to |
29 |
|
|
* @param port : port to be used |
30 |
|
|
* @return corresponding PZmqParam |
31 |
|
|
*/ |
32 |
|
8 |
PEmptyBackend::Param PEmptyBackend::server(const std::string & address, size_t port){ |
33 |
|
8 |
return PEmptyBackend::client(address, port); |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
///Create a client socket |
37 |
|
|
/** @param[out] socket : socket to be created |
38 |
|
|
* @param address : address of the server, the client has to connect to |
39 |
|
|
* @param port : port to be used for the connection |
40 |
|
|
* @param param : extra customisable parameters for the creation of the socket (depends on the backend) |
41 |
|
|
* @return true if the socket has been created, false otherwise |
42 |
|
|
*/ |
43 |
|
✗ |
bool PEmptyBackend::createClientSocket(PEmptyBackend::Socket & socket, const std::string & address, size_t port, const PEmptyParam & param){ |
44 |
|
✗ |
return true; |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
///Create a client socket |
48 |
|
|
/** @param[out] socket : socket to be created |
49 |
|
|
* @param address : address of the server, the client has to connect to |
50 |
|
|
* @param port : port to be used for the connection |
51 |
|
|
* @param param : extra customisable parameters for the creation of the socket (depends on the backend) |
52 |
|
|
* @return true if the socket has been created, false otherwise |
53 |
|
|
*/ |
54 |
|
✗ |
bool PEmptyBackend::createServerSocket(PEmptyBackend::Socket & socket, const std::string & address, size_t port, const PEmptyParam & param){ |
55 |
|
✗ |
return true; |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
///Create a client socket |
59 |
|
|
/** @param[out] socket : socket to be created |
60 |
|
|
* @param param : extra customisable parameters for the creation of the socket (depends on the backend) |
61 |
|
|
* @return true if the socket has been created, false otherwise |
62 |
|
|
*/ |
63 |
|
2 |
bool PEmptyBackend::createClientSocket(PEmptyBackend::Socket & socket, const PEmptyParam & param){ |
64 |
|
2 |
return true; |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
///Create a client socket |
68 |
|
|
/** @param[out] socket : socket to be created |
69 |
|
|
* @param param : extra customisable parameters for the creation of the socket (depends on the backend) |
70 |
|
|
* @return true if the socket has been created, false otherwise |
71 |
|
|
*/ |
72 |
|
2 |
bool PEmptyBackend::createServerSocket(PEmptyBackend::Socket & socket, const PEmptyParam & param){ |
73 |
|
2 |
return true; |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
///Send message on the given socket |
77 |
|
|
/** @param socket : socket to be used |
78 |
|
|
* @param msg : message to be sent |
79 |
|
|
* @param flag : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
80 |
|
|
* @return true on success, false otherwise |
81 |
|
|
*/ |
82 |
|
20 |
bool PEmptyBackend::send(PEmptyBackend::Socket & socket, const PEmptyBackend::Message & msg, PSendFlag::PSendFlag flag){ |
83 |
|
20 |
return true; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
///Recieve message from the given socket |
87 |
|
|
/** @param socket : socket to be used |
88 |
|
|
* @param msg : message to be recieved |
89 |
|
|
* @param flag : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
90 |
|
|
* @return true on success, false otherwise |
91 |
|
|
*/ |
92 |
|
20 |
bool PEmptyBackend::recv(PEmptyBackend::Socket & socket, PEmptyBackend::Message & msg, PRecvFlag::PRecvFlag flag){ |
93 |
|
20 |
return false; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
///Resize a message |
97 |
|
|
/** @param[out] msg : message to be resized |
98 |
|
|
* @param sizeMsg : new size of the message |
99 |
|
|
*/ |
100 |
|
20 |
void PEmptyBackend::msgResize(PEmptyBackend::Message& msg, size_t sizeMsg){ |
101 |
|
20 |
msg.resize(sizeMsg); |
102 |
|
20 |
} |
103 |
|
|
|
104 |
|
|
///Get the size of a message |
105 |
|
|
/** @param msg : message to be used |
106 |
|
|
* @return size of the message in bytes |
107 |
|
|
*/ |
108 |
|
20 |
size_t PEmptyBackend::msgSize(const PEmptyBackend::Message& msg){ |
109 |
|
20 |
return msg.size(); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
///Get the data of a message |
113 |
|
|
/** @param msg : message to be used |
114 |
|
|
* @return data of the message in bytes |
115 |
|
|
*/ |
116 |
|
✗ |
const DataStreamIter PEmptyBackend::msgData(const PEmptyBackend::Message& msg){ |
117 |
|
✗ |
return (const DataStreamIter)msg.data(); |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
///Get the data of a message |
121 |
|
|
/** @param msg : message to be used |
122 |
|
|
* @return data of the message in bytes |
123 |
|
|
*/ |
124 |
|
40 |
DataStreamIter PEmptyBackend::msgData(PEmptyBackend::Message& msg){ |
125 |
|
40 |
return msg.data(); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
|
129 |
|
|
///Close the given socket |
130 |
|
|
/** @param[out] socket : socket to be closed |
131 |
|
|
*/ |
132 |
|
4 |
void PEmptyBackend::close(PEmptyBackend::Socket & socket){ |
133 |
|
|
|
134 |
|
4 |
} |
135 |
|
|
|
136 |
|
|
///Close the given socket |
137 |
|
|
/** @param socket : socket to be checked |
138 |
|
|
* @return true if the socket is connected, false otherwise |
139 |
|
|
*/ |
140 |
|
2 |
bool PEmptyBackend::isConnected(const PEmptyBackend::Socket & socket){ |
141 |
|
2 |
return true; |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|