Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
628adf1c
Commit
628adf1c
authored
Dec 24, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: inconsistent polymorphic inheritance
Solution: consistently use virtual, override and final
parent
6d698982
Show whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
517 additions
and
479 deletions
+517
-479
.clang-tidy
.clang-tidy
+4
-0
client.hpp
src/client.hpp
+10
-10
ctx.hpp
src/ctx.hpp
+1
-1
curve_client.hpp
src/curve_client.hpp
+7
-7
curve_mechanism_base.hpp
src/curve_mechanism_base.hpp
+2
-2
curve_server.hpp
src/curve_server.hpp
+6
-6
dealer.hpp
src/dealer.hpp
+12
-10
decoder.hpp
src/decoder.hpp
+4
-6
devpoll.hpp
src/devpoll.hpp
+3
-3
dgram.hpp
src/dgram.hpp
+10
-10
dish.hpp
src/dish.hpp
+18
-18
encoder.hpp
src/encoder.hpp
+3
-5
epoll.hpp
src/epoll.hpp
+3
-3
gather.hpp
src/gather.hpp
+7
-7
gssapi_client.hpp
src/gssapi_client.hpp
+7
-7
gssapi_mechanism_base.hpp
src/gssapi_mechanism_base.hpp
+1
-1
gssapi_server.hpp
src/gssapi_server.hpp
+9
-8
io_object.hpp
src/io_object.hpp
+4
-4
io_thread.hpp
src/io_thread.hpp
+6
-6
ipc_connecter.hpp
src/ipc_connecter.hpp
+3
-3
ipc_listener.hpp
src/ipc_listener.hpp
+5
-4
kqueue.hpp
src/kqueue.hpp
+3
-3
macros.hpp
src/macros.hpp
+16
-0
mailbox.hpp
src/mailbox.hpp
+5
-5
mailbox_safe.hpp
src/mailbox_safe.hpp
+5
-5
norm_engine.hpp
src/norm_engine.hpp
+9
-9
null_mechanism.hpp
src/null_mechanism.hpp
+6
-6
own.hpp
src/own.hpp
+6
-6
pair.hpp
src/pair.hpp
+10
-10
pgm_receiver.hpp
src/pgm_receiver.hpp
+1
-1
pgm_sender.hpp
src/pgm_sender.hpp
+1
-1
pipe.hpp
src/pipe.hpp
+11
-10
plain_client.hpp
src/plain_client.hpp
+5
-5
plain_server.hpp
src/plain_server.hpp
+4
-4
poll.hpp
src/poll.hpp
+2
-2
poller_base.cpp
src/poller_base.cpp
+0
-4
poller_base.hpp
src/poller_base.hpp
+2
-2
pollset.hpp
src/pollset.hpp
+3
-3
pub.hpp
src/pub.hpp
+5
-5
pull.hpp
src/pull.hpp
+7
-7
push.hpp
src/push.hpp
+7
-7
radio.hpp
src/radio.hpp
+17
-16
raw_decoder.hpp
src/raw_decoder.hpp
+8
-7
raw_encoder.hpp
src/raw_encoder.hpp
+2
-2
raw_engine.hpp
src/raw_engine.hpp
+5
-5
reaper.hpp
src/reaper.hpp
+8
-8
rep.hpp
src/rep.hpp
+6
-6
req.hpp
src/req.hpp
+13
-12
router.hpp
src/router.hpp
+12
-10
scatter.hpp
src/scatter.hpp
+7
-7
select.hpp
src/select.hpp
+3
-3
server.hpp
src/server.hpp
+10
-10
session_base.hpp
src/session_base.hpp
+9
-9
socket_base.hpp
src/socket_base.hpp
+22
-20
socks_connecter.hpp
src/socks_connecter.hpp
+5
-5
stream.hpp
src/stream.hpp
+11
-10
stream_connecter_base.hpp
src/stream_connecter_base.hpp
+5
-5
stream_engine_base.hpp
src/stream_engine_base.hpp
+11
-10
stream_listener_base.hpp
src/stream_listener_base.hpp
+3
-3
sub.hpp
src/sub.hpp
+6
-5
tcp_connecter.hpp
src/tcp_connecter.hpp
+6
-6
tcp_listener.hpp
src/tcp_listener.hpp
+4
-3
tipc_connecter.hpp
src/tipc_connecter.hpp
+3
-3
tipc_listener.hpp
src/tipc_listener.hpp
+4
-3
udp_engine.hpp
src/udp_engine.hpp
+11
-10
v1_decoder.hpp
src/v1_decoder.hpp
+3
-3
v1_encoder.hpp
src/v1_encoder.hpp
+2
-2
v2_decoder.hpp
src/v2_decoder.hpp
+3
-3
v2_encoder.hpp
src/v2_encoder.hpp
+2
-2
vmci_connecter.hpp
src/vmci_connecter.hpp
+1
-1
vmci_listener.hpp
src/vmci_listener.hpp
+1
-1
ws_connecter.hpp
src/ws_connecter.hpp
+7
-7
ws_decoder.hpp
src/ws_decoder.hpp
+3
-3
ws_encoder.hpp
src/ws_encoder.hpp
+2
-2
ws_engine.hpp
src/ws_engine.hpp
+2
-2
ws_listener.hpp
src/ws_listener.hpp
+6
-5
xpub.hpp
src/xpub.hpp
+11
-10
xsub.hpp
src/xsub.hpp
+13
-11
ypipe.hpp
src/ypipe.hpp
+7
-7
ypipe_conflate.hpp
src/ypipe_conflate.hpp
+10
-7
zap_client.hpp
src/zap_client.hpp
+4
-4
zmtp_engine.hpp
src/zmtp_engine.hpp
+8
-8
unittest_ip_resolver.cpp
unittests/unittest_ip_resolver.cpp
+5
-4
unittest_poller.cpp
unittests/unittest_poller.cpp
+3
-3
No files found.
.clang-tidy
View file @
628adf1c
...
@@ -420,3 +420,7 @@ CheckOptions:
...
@@ -420,3 +420,7 @@ CheckOptions:
# value: '0'
# value: '0'
# - key: readability-simplify-boolean-expr.ChainedConditionalReturn
# - key: readability-simplify-boolean-expr.ChainedConditionalReturn
# value: '0'
# value: '0'
- key: modernize-use-override.OverrideSpelling
value: 'ZMQ_OVERRIDE'
- key: modernize-use-override.FinalSpelling
value: 'ZMQ_FINAL'
src/client.hpp
View file @
628adf1c
...
@@ -41,24 +41,24 @@ class msg_t;
...
@@ -41,24 +41,24 @@ class msg_t;
class
pipe_t
;
class
pipe_t
;
class
io_thread_t
;
class
io_thread_t
;
class
client_t
:
public
socket_base_t
class
client_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
client_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
client_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
client_t
();
~
client_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Messages are fair-queued from inbound pipes. And load-balanced to
// Messages are fair-queued from inbound pipes. And load-balanced to
...
...
src/ctx.hpp
View file @
628adf1c
...
@@ -90,7 +90,7 @@ class thread_ctx_t
...
@@ -90,7 +90,7 @@ class thread_ctx_t
// Context object encapsulates all the global state associated with
// Context object encapsulates all the global state associated with
// the library.
// the library.
class
ctx_t
:
public
thread_ctx_t
class
ctx_t
ZMQ_FINAL
:
public
thread_ctx_t
{
{
public
:
public
:
// Create the context object.
// Create the context object.
...
...
src/curve_client.hpp
View file @
628adf1c
...
@@ -41,18 +41,18 @@ namespace zmq
...
@@ -41,18 +41,18 @@ namespace zmq
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
curve_client_t
:
public
curve_mechanism_base_t
class
curve_client_t
ZMQ_FINAL
:
public
curve_mechanism_base_t
{
{
public
:
public
:
curve_client_t
(
session_base_t
*
session_
,
const
options_t
&
options_
);
curve_client_t
(
session_base_t
*
session_
,
const
options_t
&
options_
);
virtual
~
curve_client_t
()
;
~
curve_client_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
encode
(
msg_t
*
msg_
)
;
int
encode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
decode
(
msg_t
*
msg_
)
;
int
decode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
private
:
private
:
enum
state_t
enum
state_t
...
...
src/curve_mechanism_base.hpp
View file @
628adf1c
...
@@ -61,8 +61,8 @@ class curve_mechanism_base_t : public virtual mechanism_base_t
...
@@ -61,8 +61,8 @@ class curve_mechanism_base_t : public virtual mechanism_base_t
const
char
*
decode_nonce_prefix_
);
const
char
*
decode_nonce_prefix_
);
// mechanism implementation
// mechanism implementation
virtual
int
encode
(
msg_t
*
msg_
)
;
int
encode
(
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
virtual
int
decode
(
msg_t
*
msg_
)
;
int
decode
(
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
protected
:
protected
:
const
char
*
encode_nonce_prefix
;
const
char
*
encode_nonce_prefix
;
...
...
src/curve_server.hpp
View file @
628adf1c
...
@@ -42,20 +42,20 @@ namespace zmq
...
@@ -42,20 +42,20 @@ namespace zmq
#pragma warning(push)
#pragma warning(push)
#pragma warning(disable : 4250)
#pragma warning(disable : 4250)
#endif
#endif
class
curve_server_t
:
public
zap_client_common_handshake_t
,
class
curve_server_t
ZMQ_FINAL
:
public
zap_client_common_handshake_t
,
public
curve_mechanism_base_t
public
curve_mechanism_base_t
{
{
public
:
public
:
curve_server_t
(
session_base_t
*
session_
,
curve_server_t
(
session_base_t
*
session_
,
const
std
::
string
&
peer_address_
,
const
std
::
string
&
peer_address_
,
const
options_t
&
options_
);
const
options_t
&
options_
);
virtual
~
curve_server_t
()
;
~
curve_server_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
encode
(
msg_t
*
msg_
)
;
int
encode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
decode
(
msg_t
*
msg_
)
;
int
decode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
private
:
private
:
// Our secret key (s)
// Our secret key (s)
...
...
src/dealer.hpp
View file @
628adf1c
...
@@ -47,21 +47,23 @@ class dealer_t : public socket_base_t
...
@@ -47,21 +47,23 @@ class dealer_t : public socket_base_t
{
{
public
:
public
:
dealer_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
dealer_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
dealer_t
();
~
dealer_t
()
ZMQ_OVERRIDE
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
xsetsockopt
(
int
option_
,
int
xsend
(
zmq
::
msg_t
*
msg_
);
const
void
*
optval_
,
int
xrecv
(
zmq
::
msg_t
*
msg_
);
size_t
optvallen_
)
ZMQ_OVERRIDE
;
bool
xhas_in
();
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
bool
xhas_out
();
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
bool
xhas_in
()
ZMQ_OVERRIDE
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
bool
xhas_out
()
ZMQ_OVERRIDE
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_OVERRIDE
;
// Send and recv - knowing which pipe was used.
// Send and recv - knowing which pipe was used.
int
sendpipe
(
zmq
::
msg_t
*
msg_
,
zmq
::
pipe_t
**
pipe_
);
int
sendpipe
(
zmq
::
msg_t
*
msg_
,
zmq
::
pipe_t
**
pipe_
);
...
...
src/decoder.hpp
View file @
628adf1c
...
@@ -66,12 +66,10 @@ class decoder_base_t : public i_decoder
...
@@ -66,12 +66,10 @@ class decoder_base_t : public i_decoder
_buf
=
_allocator
.
allocate
();
_buf
=
_allocator
.
allocate
();
}
}
// The destructor doesn't have to be virtual. It is made virtual
~
decoder_base_t
()
ZMQ_OVERRIDE
{
_allocator
.
deallocate
();
}
// just to keep ICC and code checking tools from complaining.
virtual
~
decoder_base_t
()
{
_allocator
.
deallocate
();
}
// Returns a buffer to be filled with binary data.
// Returns a buffer to be filled with binary data.
void
get_buffer
(
unsigned
char
**
data_
,
std
::
size_t
*
size_
)
void
get_buffer
(
unsigned
char
**
data_
,
std
::
size_t
*
size_
)
ZMQ_FINAL
{
{
_buf
=
_allocator
.
allocate
();
_buf
=
_allocator
.
allocate
();
...
@@ -101,7 +99,7 @@ class decoder_base_t : public i_decoder
...
@@ -101,7 +99,7 @@ class decoder_base_t : public i_decoder
// Number of bytes processed is returned in bytes_used_.
// Number of bytes processed is returned in bytes_used_.
int
decode
(
const
unsigned
char
*
data_
,
int
decode
(
const
unsigned
char
*
data_
,
std
::
size_t
size_
,
std
::
size_t
size_
,
std
::
size_t
&
bytes_used_
)
std
::
size_t
&
bytes_used_
)
ZMQ_FINAL
{
{
bytes_used_
=
0
;
bytes_used_
=
0
;
...
@@ -149,7 +147,7 @@ class decoder_base_t : public i_decoder
...
@@ -149,7 +147,7 @@ class decoder_base_t : public i_decoder
return
0
;
return
0
;
}
}
v
irtual
void
resize_buffer
(
std
::
size_t
new_size_
)
v
oid
resize_buffer
(
std
::
size_t
new_size_
)
ZMQ_FINAL
{
{
_allocator
.
resize
(
new_size_
);
_allocator
.
resize
(
new_size_
);
}
}
...
...
src/devpoll.hpp
View file @
628adf1c
...
@@ -47,13 +47,13 @@ struct i_poll_events;
...
@@ -47,13 +47,13 @@ struct i_poll_events;
// Implements socket polling mechanism using the "/dev/poll" interface.
// Implements socket polling mechanism using the "/dev/poll" interface.
class
devpoll_t
:
public
worker_poller_base_t
class
devpoll_t
ZMQ_FINAL
:
public
worker_poller_base_t
{
{
public
:
public
:
typedef
fd_t
handle_t
;
typedef
fd_t
handle_t
;
devpoll_t
(
const
thread_ctx_t
&
ctx_
);
devpoll_t
(
const
thread_ctx_t
&
ctx_
);
~
devpoll_t
();
~
devpoll_t
()
ZMQ_FINAL
;
// "poller" concept.
// "poller" concept.
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
...
@@ -68,7 +68,7 @@ class devpoll_t : public worker_poller_base_t
...
@@ -68,7 +68,7 @@ class devpoll_t : public worker_poller_base_t
private
:
private
:
// Main event loop.
// Main event loop.
void
loop
();
void
loop
()
ZMQ_FINAL
;
// File descriptor referring to "/dev/poll" pseudo-device.
// File descriptor referring to "/dev/poll" pseudo-device.
fd_t
devpoll_fd
;
fd_t
devpoll_fd
;
...
...
src/dgram.hpp
View file @
628adf1c
...
@@ -41,23 +41,23 @@ class msg_t;
...
@@ -41,23 +41,23 @@ class msg_t;
class
pipe_t
;
class
pipe_t
;
class
io_thread_t
;
class
io_thread_t
;
class
dgram_t
:
public
socket_base_t
class
dgram_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
dgram_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
dgram_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
dgram_t
();
~
dgram_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
zmq
::
pipe_t
*
_pipe
;
zmq
::
pipe_t
*
_pipe
;
...
...
src/dish.hpp
View file @
628adf1c
...
@@ -44,27 +44,27 @@ class ctx_t;
...
@@ -44,27 +44,27 @@ class ctx_t;
class
pipe_t
;
class
pipe_t
;
class
io_thread_t
;
class
io_thread_t
;
class
dish_t
:
public
socket_base_t
class
dish_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
dish_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
dish_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
dish_t
();
~
dish_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xhiccuped
(
pipe_t
*
pipe_
);
void
xhiccuped
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
xjoin
(
const
char
*
group_
);
int
xjoin
(
const
char
*
group_
)
ZMQ_FINAL
;
int
xleave
(
const
char
*
group_
);
int
xleave
(
const
char
*
group_
)
ZMQ_FINAL
;
private
:
private
:
int
xxrecv
(
zmq
::
msg_t
*
msg_
);
int
xxrecv
(
zmq
::
msg_t
*
msg_
);
...
@@ -90,7 +90,7 @@ class dish_t : public socket_base_t
...
@@ -90,7 +90,7 @@ class dish_t : public socket_base_t
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
dish_t
)
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
dish_t
)
};
};
class
dish_session_t
:
public
session_base_t
class
dish_session_t
ZMQ_FINAL
:
public
session_base_t
{
{
public
:
public
:
dish_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
dish_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -98,12 +98,12 @@ class dish_session_t : public session_base_t
...
@@ -98,12 +98,12 @@ class dish_session_t : public session_base_t
zmq
::
socket_base_t
*
socket_
,
zmq
::
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
address_t
*
addr_
);
address_t
*
addr_
);
~
dish_session_t
();
~
dish_session_t
()
ZMQ_FINAL
;
// Overrides of the functions from session_base_t.
// Overrides of the functions from session_base_t.
int
push_msg
(
msg_t
*
msg_
);
int
push_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
;
int
pull_msg
(
msg_t
*
msg_
);
int
pull_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
;
void
reset
();
void
reset
()
ZMQ_FINAL
;
private
:
private
:
enum
enum
...
...
src/encoder.hpp
View file @
628adf1c
...
@@ -66,14 +66,12 @@ template <typename T> class encoder_base_t : public i_encoder
...
@@ -66,14 +66,12 @@ template <typename T> class encoder_base_t : public i_encoder
alloc_assert
(
_buf
);
alloc_assert
(
_buf
);
}
}
// The destructor doesn't have to be virtual. It is made virtual
inline
~
encoder_base_t
()
ZMQ_OVERRIDE
{
free
(
_buf
);
}
// just to keep ICC and code checking tools from complaining.
inline
virtual
~
encoder_base_t
()
{
free
(
_buf
);
}
// The function returns a batch of binary data. The data
// The function returns a batch of binary data. The data
// are filled to a supplied buffer. If no buffer is supplied (data_
// are filled to a supplied buffer. If no buffer is supplied (data_
// points to NULL) decoder object will provide buffer of its own.
// points to NULL) decoder object will provide buffer of its own.
inline
size_t
encode
(
unsigned
char
**
data_
,
size_t
size_
)
inline
size_t
encode
(
unsigned
char
**
data_
,
size_t
size_
)
ZMQ_FINAL
{
{
unsigned
char
*
buffer
=
!*
data_
?
_buf
:
*
data_
;
unsigned
char
*
buffer
=
!*
data_
?
_buf
:
*
data_
;
size_t
buffersize
=
!*
data_
?
_buf_size
:
size_
;
size_t
buffersize
=
!*
data_
?
_buf_size
:
size_
;
...
@@ -128,7 +126,7 @@ template <typename T> class encoder_base_t : public i_encoder
...
@@ -128,7 +126,7 @@ template <typename T> class encoder_base_t : public i_encoder
return
pos
;
return
pos
;
}
}
void
load_msg
(
msg_t
*
msg_
)
void
load_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
{
{
zmq_assert
(
in_progress
()
==
NULL
);
zmq_assert
(
in_progress
()
==
NULL
);
_in_progress
=
msg_
;
_in_progress
=
msg_
;
...
...
src/epoll.hpp
View file @
628adf1c
...
@@ -55,13 +55,13 @@ struct i_poll_events;
...
@@ -55,13 +55,13 @@ struct i_poll_events;
// This class implements socket polling mechanism using the Linux-specific
// This class implements socket polling mechanism using the Linux-specific
// epoll mechanism.
// epoll mechanism.
class
epoll_t
:
public
worker_poller_base_t
class
epoll_t
ZMQ_FINAL
:
public
worker_poller_base_t
{
{
public
:
public
:
typedef
void
*
handle_t
;
typedef
void
*
handle_t
;
epoll_t
(
const
thread_ctx_t
&
ctx_
);
epoll_t
(
const
thread_ctx_t
&
ctx_
);
~
epoll_t
();
~
epoll_t
()
ZMQ_OVERRIDE
;
// "poller" concept.
// "poller" concept.
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
...
@@ -87,7 +87,7 @@ class epoll_t : public worker_poller_base_t
...
@@ -87,7 +87,7 @@ class epoll_t : public worker_poller_base_t
#endif
#endif
// Main event loop.
// Main event loop.
void
loop
();
void
loop
()
ZMQ_FINAL
;
// Main epoll file descriptor
// Main epoll file descriptor
epoll_fd_t
_epoll_fd
;
epoll_fd_t
_epoll_fd
;
...
...
src/gather.hpp
View file @
628adf1c
...
@@ -39,21 +39,21 @@ class ctx_t;
...
@@ -39,21 +39,21 @@ class ctx_t;
class
pipe_t
;
class
pipe_t
;
class
msg_t
;
class
msg_t
;
class
gather_t
:
public
socket_base_t
class
gather_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
gather_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
gather_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
gather_t
();
~
gather_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Fair queueing object for inbound pipes.
// Fair queueing object for inbound pipes.
...
...
src/gssapi_client.hpp
View file @
628adf1c
...
@@ -39,18 +39,18 @@ namespace zmq
...
@@ -39,18 +39,18 @@ namespace zmq
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
gssapi_client_t
:
public
gssapi_mechanism_base_t
class
gssapi_client_t
ZMQ_FINAL
:
public
gssapi_mechanism_base_t
{
{
public
:
public
:
gssapi_client_t
(
session_base_t
*
session_
,
const
options_t
&
options_
);
gssapi_client_t
(
session_base_t
*
session_
,
const
options_t
&
options_
);
virtual
~
gssapi_client_t
()
;
~
gssapi_client_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
encode
(
msg_t
*
msg_
)
;
int
encode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
decode
(
msg_t
*
msg_
)
;
int
decode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
private
:
private
:
enum
state_t
enum
state_t
...
...
src/gssapi_mechanism_base.hpp
View file @
628adf1c
...
@@ -53,7 +53,7 @@ class gssapi_mechanism_base_t : public virtual mechanism_base_t
...
@@ -53,7 +53,7 @@ class gssapi_mechanism_base_t : public virtual mechanism_base_t
public
:
public
:
gssapi_mechanism_base_t
(
session_base_t
*
session_
,
gssapi_mechanism_base_t
(
session_base_t
*
session_
,
const
options_t
&
options_
);
const
options_t
&
options_
);
virtual
~
gssapi_mechanism_base_t
()
=
0
;
~
gssapi_mechanism_base_t
()
ZMQ_OVERRIDE
=
0
;
protected
:
protected
:
// Produce a context-level GSSAPI token (INITIATE command)
// Produce a context-level GSSAPI token (INITIATE command)
...
...
src/gssapi_server.hpp
View file @
628adf1c
...
@@ -40,21 +40,22 @@ namespace zmq
...
@@ -40,21 +40,22 @@ namespace zmq
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
gssapi_server_t
:
public
gssapi_mechanism_base_t
,
public
zap_client_t
class
gssapi_server_t
ZMQ_FINAL
:
public
gssapi_mechanism_base_t
,
public
zap_client_t
{
{
public
:
public
:
gssapi_server_t
(
session_base_t
*
session_
,
gssapi_server_t
(
session_base_t
*
session_
,
const
std
::
string
&
peer_address
,
const
std
::
string
&
peer_address
,
const
options_t
&
options_
);
const
options_t
&
options_
);
virtual
~
gssapi_server_t
()
;
~
gssapi_server_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
encode
(
msg_t
*
msg_
)
;
int
encode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
decode
(
msg_t
*
msg_
)
;
int
decode
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
zap_msg_available
()
;
int
zap_msg_available
()
ZMQ_FINAL
;
virtual
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
private
:
private
:
enum
state_t
enum
state_t
...
...
src/io_object.hpp
View file @
628adf1c
...
@@ -48,7 +48,7 @@ class io_object_t : public i_poll_events
...
@@ -48,7 +48,7 @@ class io_object_t : public i_poll_events
{
{
public
:
public
:
io_object_t
(
zmq
::
io_thread_t
*
io_thread_
=
NULL
);
io_object_t
(
zmq
::
io_thread_t
*
io_thread_
=
NULL
);
~
io_object_t
();
~
io_object_t
()
ZMQ_OVERRIDE
;
// When migrating an object from one I/O thread to another, first
// When migrating an object from one I/O thread to another, first
// unplug it, then migrate it, then plug it to the new thread.
// unplug it, then migrate it, then plug it to the new thread.
...
@@ -69,9 +69,9 @@ class io_object_t : public i_poll_events
...
@@ -69,9 +69,9 @@ class io_object_t : public i_poll_events
void
cancel_timer
(
int
id_
);
void
cancel_timer
(
int
id_
);
// i_poll_events interface implementation.
// i_poll_events interface implementation.
void
in_event
();
void
in_event
()
ZMQ_OVERRIDE
;
void
out_event
();
void
out_event
()
ZMQ_OVERRIDE
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_OVERRIDE
;
private
:
private
:
poller_t
*
_poller
;
poller_t
*
_poller
;
...
...
src/io_thread.hpp
View file @
628adf1c
...
@@ -43,14 +43,14 @@ class ctx_t;
...
@@ -43,14 +43,14 @@ class ctx_t;
// Generic part of the I/O thread. Polling-mechanism-specific features
// Generic part of the I/O thread. Polling-mechanism-specific features
// are implemented in separate "polling objects".
// are implemented in separate "polling objects".
class
io_thread_t
:
public
object_t
,
public
i_poll_events
class
io_thread_t
ZMQ_FINAL
:
public
object_t
,
public
i_poll_events
{
{
public
:
public
:
io_thread_t
(
zmq
::
ctx_t
*
ctx_
,
uint32_t
tid_
);
io_thread_t
(
zmq
::
ctx_t
*
ctx_
,
uint32_t
tid_
);
// Clean-up. If the thread was started, it's necessary to call 'stop'
// Clean-up. If the thread was started, it's necessary to call 'stop'
// before invoking destructor. Otherwise the destructor would hang up.
// before invoking destructor. Otherwise the destructor would hang up.
~
io_thread_t
();
~
io_thread_t
()
ZMQ_FINAL
;
// Launch the physical thread.
// Launch the physical thread.
void
start
();
void
start
();
...
@@ -62,15 +62,15 @@ class io_thread_t : public object_t, public i_poll_events
...
@@ -62,15 +62,15 @@ class io_thread_t : public object_t, public i_poll_events
mailbox_t
*
get_mailbox
();
mailbox_t
*
get_mailbox
();
// i_poll_events implementation.
// i_poll_events implementation.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
// Used by io_objects to retrieve the associated poller object.
// Used by io_objects to retrieve the associated poller object.
poller_t
*
get_poller
();
poller_t
*
get_poller
();
// Command handlers.
// Command handlers.
void
process_stop
();
void
process_stop
()
ZMQ_FINAL
;
// Returns load experienced by the I/O thread.
// Returns load experienced by the I/O thread.
int
get_load
();
int
get_load
();
...
...
src/ipc_connecter.hpp
View file @
628adf1c
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
namespace
zmq
namespace
zmq
{
{
class
ipc_connecter_t
:
public
stream_connecter_base_t
class
ipc_connecter_t
ZMQ_FINAL
:
public
stream_connecter_base_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
@@ -50,10 +50,10 @@ class ipc_connecter_t : public stream_connecter_base_t
...
@@ -50,10 +50,10 @@ class ipc_connecter_t : public stream_connecter_base_t
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
// Internal function to start the actual connection establishment.
// Internal function to start the actual connection establishment.
void
start_connecting
();
void
start_connecting
()
ZMQ_FINAL
;
// Open IPC connecting socket. Returns -1 in case of error,
// Open IPC connecting socket. Returns -1 in case of error,
// 0 if connect was successful immediately. Returns -1 with
// 0 if connect was successful immediately. Returns -1 with
...
...
src/ipc_listener.hpp
View file @
628adf1c
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
namespace
zmq
namespace
zmq
{
{
class
ipc_listener_t
:
public
stream_listener_base_t
class
ipc_listener_t
ZMQ_FINAL
:
public
stream_listener_base_t
{
{
public
:
public
:
ipc_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
ipc_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -50,11 +50,12 @@ class ipc_listener_t : public stream_listener_base_t
...
@@ -50,11 +50,12 @@ class ipc_listener_t : public stream_listener_base_t
int
set_local_address
(
const
char
*
addr_
);
int
set_local_address
(
const
char
*
addr_
);
protected
:
protected
:
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
;
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
ZMQ_FINAL
;
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
// Filter new connections if the OS provides a mechanism to get
// Filter new connections if the OS provides a mechanism to get
// the credentials of the peer process. Called from accept().
// the credentials of the peer process. Called from accept().
...
@@ -62,7 +63,7 @@ class ipc_listener_t : public stream_listener_base_t
...
@@ -62,7 +63,7 @@ class ipc_listener_t : public stream_listener_base_t
bool
filter
(
fd_t
sock_
);
bool
filter
(
fd_t
sock_
);
#endif
#endif
int
close
();
int
close
()
ZMQ_FINAL
;
// Accept the new connection. Returns the file descriptor of the
// Accept the new connection. Returns the file descriptor of the
// newly created connection. The function may return retired_fd
// newly created connection. The function may return retired_fd
...
...
src/kqueue.hpp
View file @
628adf1c
...
@@ -49,13 +49,13 @@ struct i_poll_events;
...
@@ -49,13 +49,13 @@ struct i_poll_events;
// Implements socket polling mechanism using the BSD-specific
// Implements socket polling mechanism using the BSD-specific
// kqueue interface.
// kqueue interface.
class
kqueue_t
:
public
worker_poller_base_t
class
kqueue_t
ZMQ_FINAL
:
public
worker_poller_base_t
{
{
public
:
public
:
typedef
void
*
handle_t
;
typedef
void
*
handle_t
;
kqueue_t
(
const
thread_ctx_t
&
ctx_
);
kqueue_t
(
const
thread_ctx_t
&
ctx_
);
~
kqueue_t
();
~
kqueue_t
()
ZMQ_FINAL
;
// "poller" concept.
// "poller" concept.
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
...
@@ -70,7 +70,7 @@ class kqueue_t : public worker_poller_base_t
...
@@ -70,7 +70,7 @@ class kqueue_t : public worker_poller_base_t
private
:
private
:
// Main event loop.
// Main event loop.
void
loop
();
void
loop
()
ZMQ_FINAL
;
// File descriptor referring to the kernel event queue.
// File descriptor referring to the kernel event queue.
fd_t
kqueue_fd
;
fd_t
kqueue_fd
;
...
...
src/macros.hpp
View file @
628adf1c
...
@@ -20,6 +20,22 @@
...
@@ -20,6 +20,22 @@
#endif
#endif
#endif
#endif
#if !defined ZMQ_OVERRIDE
#if defined ZMQ_HAVE_NOEXCEPT
#define ZMQ_OVERRIDE override
#else
#define ZMQ_OVERRIDE
#endif
#endif
#if !defined ZMQ_FINAL
#if defined ZMQ_HAVE_NOEXCEPT
#define ZMQ_FINAL final
#else
#define ZMQ_FINAL
#endif
#endif
#if !defined ZMQ_DEFAULT
#if !defined ZMQ_DEFAULT
#if defined ZMQ_HAVE_NOEXCEPT
#if defined ZMQ_HAVE_NOEXCEPT
#define ZMQ_DEFAULT = default;
#define ZMQ_DEFAULT = default;
...
...
src/mailbox.hpp
View file @
628adf1c
...
@@ -42,15 +42,15 @@
...
@@ -42,15 +42,15 @@
namespace
zmq
namespace
zmq
{
{
class
mailbox_t
:
public
i_mailbox
class
mailbox_t
ZMQ_FINAL
:
public
i_mailbox
{
{
public
:
public
:
mailbox_t
();
mailbox_t
();
~
mailbox_t
();
~
mailbox_t
()
ZMQ_FINAL
;
fd_t
get_fd
()
const
;
fd_t
get_fd
()
const
;
void
send
(
const
command_t
&
cmd_
);
void
send
(
const
command_t
&
cmd_
)
ZMQ_FINAL
;
int
recv
(
command_t
*
cmd_
,
int
timeout_
);
int
recv
(
command_t
*
cmd_
,
int
timeout_
)
ZMQ_FINAL
;
bool
valid
()
const
;
bool
valid
()
const
;
...
@@ -58,7 +58,7 @@ class mailbox_t : public i_mailbox
...
@@ -58,7 +58,7 @@ class mailbox_t : public i_mailbox
// close the file descriptors in the signaller. This is used in a forked
// close the file descriptors in the signaller. This is used in a forked
// child process to close the file descriptors so that they do not interfere
// child process to close the file descriptors so that they do not interfere
// with the context in the parent process.
// with the context in the parent process.
void
forked
()
{
_signaler
.
forked
();
}
void
forked
()
ZMQ_FINAL
{
_signaler
.
forked
();
}
#endif
#endif
private
:
private
:
...
...
src/mailbox_safe.hpp
View file @
628adf1c
...
@@ -44,14 +44,14 @@
...
@@ -44,14 +44,14 @@
namespace
zmq
namespace
zmq
{
{
class
mailbox_safe_t
:
public
i_mailbox
class
mailbox_safe_t
ZMQ_FINAL
:
public
i_mailbox
{
{
public
:
public
:
mailbox_safe_t
(
mutex_t
*
sync_
);
mailbox_safe_t
(
mutex_t
*
sync_
);
~
mailbox_safe_t
();
~
mailbox_safe_t
()
ZMQ_FINAL
;
void
send
(
const
command_t
&
cmd_
);
void
send
(
const
command_t
&
cmd_
)
ZMQ_FINAL
;
int
recv
(
command_t
*
cmd_
,
int
timeout_
);
int
recv
(
command_t
*
cmd_
,
int
timeout_
)
ZMQ_FINAL
;
// Add signaler to mailbox which will be called when a message is ready
// Add signaler to mailbox which will be called when a message is ready
void
add_signaler
(
signaler_t
*
signaler_
);
void
add_signaler
(
signaler_t
*
signaler_
);
...
@@ -62,7 +62,7 @@ class mailbox_safe_t : public i_mailbox
...
@@ -62,7 +62,7 @@ class mailbox_safe_t : public i_mailbox
// close the file descriptors in the signaller. This is used in a forked
// close the file descriptors in the signaller. This is used in a forked
// child process to close the file descriptors so that they do not interfere
// child process to close the file descriptors so that they do not interfere
// with the context in the parent process.
// with the context in the parent process.
void
forked
()
void
forked
()
ZMQ_FINAL
{
{
// TODO: call fork on the condition variable
// TODO: call fork on the condition variable
}
}
...
...
src/norm_engine.hpp
View file @
628adf1c
...
@@ -18,11 +18,11 @@ class io_thread_t;
...
@@ -18,11 +18,11 @@ class io_thread_t;
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
norm_engine_t
:
public
io_object_t
,
public
i_engine
class
norm_engine_t
ZMQ_FINAL
:
public
io_object_t
,
public
i_engine
{
{
public
:
public
:
norm_engine_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
norm_engine_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
~
norm_engine_t
();
~
norm_engine_t
()
ZMQ_FINAL
;
// create NORM instance, session, etc
// create NORM instance, session, etc
int
init
(
const
char
*
network_
,
bool
send
,
bool
recv
);
int
init
(
const
char
*
network_
,
bool
send
,
bool
recv
);
...
@@ -30,24 +30,24 @@ class norm_engine_t : public io_object_t, public i_engine
...
@@ -30,24 +30,24 @@ class norm_engine_t : public io_object_t, public i_engine
// i_engine interface implementation.
// i_engine interface implementation.
// Plug the engine to the session.
// Plug the engine to the session.
v
irtual
v
oid
plug
(
zmq
::
io_thread_t
*
io_thread_
,
void
plug
(
zmq
::
io_thread_t
*
io_thread_
,
class
session_base_t
*
session_
)
;
class
session_base_t
*
session_
)
ZMQ_FINAL
;
// Terminate and deallocate the engine. Note that 'detached'
// Terminate and deallocate the engine. Note that 'detached'
// events are not fired on termination.
// events are not fired on termination.
v
irtual
void
terminate
()
;
v
oid
terminate
()
ZMQ_FINAL
;
// This method is called by the session to signalise that more
// This method is called by the session to signalise that more
// messages can be written to the pipe.
// messages can be written to the pipe.
virtual
bool
restart_input
()
;
bool
restart_input
()
ZMQ_FINAL
;
// This method is called by the session to signalise that there
// This method is called by the session to signalise that there
// are messages to send available.
// are messages to send available.
v
irtual
void
restart_output
()
;
v
oid
restart_output
()
ZMQ_FINAL
;
v
irtual
void
zap_msg_available
(){};
v
oid
zap_msg_available
()
ZMQ_FINAL
{}
virtual
const
endpoint_uri_pair_t
&
get_endpoint
()
const
;
const
endpoint_uri_pair_t
&
get_endpoint
()
const
ZMQ_FINAL
;
// i_poll_events interface implementation.
// i_poll_events interface implementation.
// (we only need in_event() for NormEvent notification)
// (we only need in_event() for NormEvent notification)
...
...
src/null_mechanism.hpp
View file @
628adf1c
...
@@ -39,19 +39,19 @@ namespace zmq
...
@@ -39,19 +39,19 @@ namespace zmq
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
null_mechanism_t
:
public
zap_client_t
class
null_mechanism_t
ZMQ_FINAL
:
public
zap_client_t
{
{
public
:
public
:
null_mechanism_t
(
session_base_t
*
session_
,
null_mechanism_t
(
session_base_t
*
session_
,
const
std
::
string
&
peer_address_
,
const
std
::
string
&
peer_address_
,
const
options_t
&
options_
);
const
options_t
&
options_
);
virtual
~
null_mechanism_t
()
;
~
null_mechanism_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
zap_msg_available
()
;
int
zap_msg_available
()
ZMQ_FINAL
;
virtual
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
private
:
private
:
bool
_ready_command_sent
;
bool
_ready_command_sent
;
...
...
src/own.hpp
View file @
628adf1c
...
@@ -90,12 +90,12 @@ class own_t : public object_t
...
@@ -90,12 +90,12 @@ class own_t : public object_t
// others to invoke the destructor. At the same time, it has to be
// others to invoke the destructor. At the same time, it has to be
// virtual so that generic own_t deallocation mechanism destroys
// virtual so that generic own_t deallocation mechanism destroys
// specific type of the owned object correctly.
// specific type of the owned object correctly.
virtual
~
own_t
()
;
~
own_t
()
ZMQ_OVERRIDE
;
// Term handler is protected rather than private so that it can
// Term handler is protected rather than private so that it can
// be intercepted by the derived class. This is useful to add custom
// be intercepted by the derived class. This is useful to add custom
// steps to the beginning of the termination process.
// steps to the beginning of the termination process.
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_OVERRIDE
;
// A place to hook in when physical destruction of the object
// A place to hook in when physical destruction of the object
// is to be delayed.
// is to be delayed.
...
@@ -109,10 +109,10 @@ class own_t : public object_t
...
@@ -109,10 +109,10 @@ class own_t : public object_t
void
set_owner
(
own_t
*
owner_
);
void
set_owner
(
own_t
*
owner_
);
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_own
(
own_t
*
object_
);
void
process_own
(
own_t
*
object_
)
ZMQ_OVERRIDE
;
void
process_term_req
(
own_t
*
object_
);
void
process_term_req
(
own_t
*
object_
)
ZMQ_OVERRIDE
;
void
process_term_ack
();
void
process_term_ack
()
ZMQ_OVERRIDE
;
void
process_seqnum
();
void
process_seqnum
()
ZMQ_OVERRIDE
;
// Check whether all the pending term acks were delivered.
// Check whether all the pending term acks were delivered.
// If so, deallocate this object.
// If so, deallocate this object.
...
...
src/pair.hpp
View file @
628adf1c
...
@@ -41,23 +41,23 @@ class msg_t;
...
@@ -41,23 +41,23 @@ class msg_t;
class
pipe_t
;
class
pipe_t
;
class
io_thread_t
;
class
io_thread_t
;
class
pair_t
:
public
socket_base_t
class
pair_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
pair_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
pair_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
pair_t
();
~
pair_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
zmq
::
pipe_t
*
_pipe
;
zmq
::
pipe_t
*
_pipe
;
...
...
src/pgm_receiver.hpp
View file @
628adf1c
...
@@ -46,7 +46,7 @@ namespace zmq
...
@@ -46,7 +46,7 @@ namespace zmq
class
io_thread_t
;
class
io_thread_t
;
class
session_base_t
;
class
session_base_t
;
class
pgm_receiver_t
:
public
io_object_t
,
public
i_engine
class
pgm_receiver_t
ZMQ_FINAL
:
public
io_object_t
,
public
i_engine
{
{
public
:
public
:
pgm_receiver_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
pgm_receiver_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
...
...
src/pgm_sender.hpp
View file @
628adf1c
...
@@ -45,7 +45,7 @@ namespace zmq
...
@@ -45,7 +45,7 @@ namespace zmq
class
io_thread_t
;
class
io_thread_t
;
class
session_base_t
;
class
session_base_t
;
class
pgm_sender_t
:
public
io_object_t
,
public
i_engine
class
pgm_sender_t
ZMQ_FINAL
:
public
io_object_t
,
public
i_engine
{
{
public
:
public
:
pgm_sender_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
pgm_sender_t
(
zmq
::
io_thread_t
*
parent_
,
const
options_t
&
options_
);
...
...
src/pipe.hpp
View file @
628adf1c
...
@@ -71,7 +71,7 @@ struct i_pipe_events
...
@@ -71,7 +71,7 @@ struct i_pipe_events
// The array of inbound pipes (1), the array of outbound pipes (2) and
// The array of inbound pipes (1), the array of outbound pipes (2) and
// the generic array of pipes to be deallocated (3).
// the generic array of pipes to be deallocated (3).
class
pipe_t
:
public
object_t
,
class
pipe_t
ZMQ_FINAL
:
public
object_t
,
public
array_item_t
<
1
>
,
public
array_item_t
<
1
>
,
public
array_item_t
<
2
>
,
public
array_item_t
<
2
>
,
public
array_item_t
<
3
>
public
array_item_t
<
3
>
...
@@ -152,15 +152,16 @@ class pipe_t : public object_t,
...
@@ -152,15 +152,16 @@ class pipe_t : public object_t,
typedef
ypipe_base_t
<
msg_t
>
upipe_t
;
typedef
ypipe_base_t
<
msg_t
>
upipe_t
;
// Command handlers.
// Command handlers.
void
process_activate_read
();
void
process_activate_read
()
ZMQ_OVERRIDE
;
void
process_activate_write
(
uint64_t
msgs_read_
);
void
process_activate_write
(
uint64_t
msgs_read_
)
ZMQ_OVERRIDE
;
void
process_hiccup
(
void
*
pipe_
);
void
process_hiccup
(
void
*
pipe_
)
ZMQ_OVERRIDE
;
void
process_pipe_peer_stats
(
uint64_t
queue_count_
,
void
process_pipe_peer_stats
(
uint64_t
queue_count_
,
own_t
*
socket_base_
,
own_t
*
socket_base_
,
endpoint_uri_pair_t
*
endpoint_pair_
)
;
endpoint_uri_pair_t
*
endpoint_pair_
)
ZMQ_OVERRIDE
;
void
process_pipe_term
();
void
process_pipe_term
()
ZMQ_OVERRIDE
;
void
process_pipe_term_ack
();
void
process_pipe_term_ack
()
ZMQ_OVERRIDE
;
void
process_pipe_hwm
(
int
inhwm_
,
int
outhwm_
);
void
process_pipe_hwm
(
int
inhwm_
,
int
outhwm_
)
ZMQ_OVERRIDE
;
// Handler for delimiter read from the pipe.
// Handler for delimiter read from the pipe.
void
process_delimiter
();
void
process_delimiter
();
...
@@ -179,7 +180,7 @@ class pipe_t : public object_t,
...
@@ -179,7 +180,7 @@ class pipe_t : public object_t,
void
set_peer
(
pipe_t
*
peer_
);
void
set_peer
(
pipe_t
*
peer_
);
// Destructor is private. Pipe objects destroy themselves.
// Destructor is private. Pipe objects destroy themselves.
~
pipe_t
();
~
pipe_t
()
ZMQ_OVERRIDE
;
// Underlying pipes for both directions.
// Underlying pipes for both directions.
upipe_t
*
_in_pipe
;
upipe_t
*
_in_pipe
;
...
...
src/plain_client.hpp
View file @
628adf1c
...
@@ -37,16 +37,16 @@ namespace zmq
...
@@ -37,16 +37,16 @@ namespace zmq
{
{
class
msg_t
;
class
msg_t
;
class
plain_client_t
:
public
mechanism_base_t
class
plain_client_t
ZMQ_FINAL
:
public
mechanism_base_t
{
{
public
:
public
:
plain_client_t
(
session_base_t
*
const
session_
,
const
options_t
&
options_
);
plain_client_t
(
session_base_t
*
const
session_
,
const
options_t
&
options_
);
virtual
~
plain_client_t
()
;
~
plain_client_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
private
:
private
:
enum
state_t
enum
state_t
...
...
src/plain_server.hpp
View file @
628adf1c
...
@@ -38,17 +38,17 @@ namespace zmq
...
@@ -38,17 +38,17 @@ namespace zmq
class
msg_t
;
class
msg_t
;
class
session_base_t
;
class
session_base_t
;
class
plain_server_t
:
public
zap_client_common_handshake_t
class
plain_server_t
ZMQ_FINAL
:
public
zap_client_common_handshake_t
{
{
public
:
public
:
plain_server_t
(
session_base_t
*
session_
,
plain_server_t
(
session_base_t
*
session_
,
const
std
::
string
&
peer_address_
,
const
std
::
string
&
peer_address_
,
const
options_t
&
options_
);
const
options_t
&
options_
);
virtual
~
plain_server_t
()
;
~
plain_server_t
()
ZMQ_FINAL
;
// mechanism implementation
// mechanism implementation
virtual
int
next_handshake_command
(
msg_t
*
msg_
)
;
int
next_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
virtual
int
process_handshake_command
(
msg_t
*
msg_
)
;
int
process_handshake_command
(
msg_t
*
msg_
)
ZMQ_FINAL
;
private
:
private
:
void
produce_welcome
(
msg_t
*
msg_
)
const
;
void
produce_welcome
(
msg_t
*
msg_
)
const
;
...
...
src/poll.hpp
View file @
628adf1c
...
@@ -56,7 +56,7 @@ struct i_poll_events;
...
@@ -56,7 +56,7 @@ struct i_poll_events;
// Implements socket polling mechanism using the POSIX.1-2001
// Implements socket polling mechanism using the POSIX.1-2001
// poll() system call.
// poll() system call.
class
poll_t
:
public
worker_poller_base_t
class
poll_t
ZMQ_FINAL
:
public
worker_poller_base_t
{
{
public
:
public
:
typedef
fd_t
handle_t
;
typedef
fd_t
handle_t
;
...
@@ -78,7 +78,7 @@ class poll_t : public worker_poller_base_t
...
@@ -78,7 +78,7 @@ class poll_t : public worker_poller_base_t
private
:
private
:
// Main event loop.
// Main event loop.
v
irtual
void
loop
()
;
v
oid
loop
()
ZMQ_FINAL
;
void
cleanup_retired
();
void
cleanup_retired
();
...
...
src/poller_base.cpp
View file @
628adf1c
...
@@ -32,10 +32,6 @@
...
@@ -32,10 +32,6 @@
#include "i_poll_events.hpp"
#include "i_poll_events.hpp"
#include "err.hpp"
#include "err.hpp"
zmq
::
poller_base_t
::
poller_base_t
()
{
}
zmq
::
poller_base_t
::~
poller_base_t
()
zmq
::
poller_base_t
::~
poller_base_t
()
{
{
// Make sure there is no more load on the shutdown.
// Make sure there is no more load on the shutdown.
...
...
src/poller_base.hpp
View file @
628adf1c
...
@@ -114,7 +114,7 @@ struct i_poll_events;
...
@@ -114,7 +114,7 @@ struct i_poll_events;
// a container that is being iterated by the poller.
// a container that is being iterated by the poller.
// A class that can be used as a
base class for implementations of the poller
// A class that can be used as abase class for implementations of the poller
// concept.
// concept.
//
//
// For documentation of the public methods, see the description of the poller_t
// For documentation of the public methods, see the description of the poller_t
...
@@ -122,7 +122,7 @@ struct i_poll_events;
...
@@ -122,7 +122,7 @@ struct i_poll_events;
class
poller_base_t
class
poller_base_t
{
{
public
:
public
:
poller_base_t
();
poller_base_t
()
ZMQ_DEFAULT
;
virtual
~
poller_base_t
();
virtual
~
poller_base_t
();
// Methods from the poller concept.
// Methods from the poller concept.
...
...
src/pollset.hpp
View file @
628adf1c
...
@@ -50,13 +50,13 @@ struct i_poll_events;
...
@@ -50,13 +50,13 @@ struct i_poll_events;
// This class implements socket polling mechanism using the AIX-specific
// This class implements socket polling mechanism using the AIX-specific
// pollset mechanism.
// pollset mechanism.
class
pollset_t
:
public
poller_base_t
class
pollset_t
ZMQ_FINAL
:
public
poller_base_t
{
{
public
:
public
:
typedef
void
*
handle_t
;
typedef
void
*
handle_t
;
pollset_t
(
const
thread_ctx_t
&
ctx_
);
pollset_t
(
const
thread_ctx_t
&
ctx_
);
~
pollset_t
();
~
pollset_t
()
ZMQ_FINAL
;
// "poller" concept.
// "poller" concept.
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
...
@@ -75,7 +75,7 @@ class pollset_t : public poller_base_t
...
@@ -75,7 +75,7 @@ class pollset_t : public poller_base_t
static
void
worker_routine
(
void
*
arg_
);
static
void
worker_routine
(
void
*
arg_
);
// Main event loop.
// Main event loop.
void
loop
();
void
loop
()
ZMQ_FINAL
;
// Reference to ZMQ context.
// Reference to ZMQ context.
const
thread_ctx_t
&
ctx
;
const
thread_ctx_t
&
ctx
;
...
...
src/pub.hpp
View file @
628adf1c
...
@@ -39,18 +39,18 @@ class io_thread_t;
...
@@ -39,18 +39,18 @@ class io_thread_t;
class
socket_base_t
;
class
socket_base_t
;
class
msg_t
;
class
msg_t
;
class
pub_t
:
public
xpub_t
class
pub_t
ZMQ_FINAL
:
public
xpub_t
{
{
public
:
public
:
pub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
pub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
pub_t
();
~
pub_t
()
ZMQ_FINAL
;
// Implementations of virtual functions from socket_base_t.
// Implementations of virtual functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
=
false
,
bool
subscribe_to_all_
=
false
,
bool
locally_initiated_
=
false
);
bool
locally_initiated_
=
false
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
pub_t
)
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
pub_t
)
};
};
...
...
src/pull.hpp
View file @
628adf1c
...
@@ -41,21 +41,21 @@ class pipe_t;
...
@@ -41,21 +41,21 @@ class pipe_t;
class
msg_t
;
class
msg_t
;
class
io_thread_t
;
class
io_thread_t
;
class
pull_t
:
public
socket_base_t
class
pull_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
pull_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
pull_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
pull_t
();
~
pull_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Fair queueing object for inbound pipes.
// Fair queueing object for inbound pipes.
...
...
src/push.hpp
View file @
628adf1c
...
@@ -41,21 +41,21 @@ class pipe_t;
...
@@ -41,21 +41,21 @@ class pipe_t;
class
msg_t
;
class
msg_t
;
class
io_thread_t
;
class
io_thread_t
;
class
push_t
:
public
socket_base_t
class
push_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
push_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
push_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
push_t
();
~
push_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Load balancer managing the outbound pipes.
// Load balancer managing the outbound pipes.
...
...
src/radio.hpp
View file @
628adf1c
...
@@ -45,24 +45,25 @@ class ctx_t;
...
@@ -45,24 +45,25 @@ class ctx_t;
class
pipe_t
;
class
pipe_t
;
class
io_thread_t
;
class
io_thread_t
;
class
radio_t
:
public
socket_base_t
class
radio_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
radio_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
radio_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
radio_t
();
~
radio_t
()
ZMQ_FINAL
;
// Implementations of virtual functions from socket_base_t.
// Implementations of virtual functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
=
false
,
bool
subscribe_to_all_
=
false
,
bool
locally_initiated_
=
false
);
bool
locally_initiated_
=
false
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// List of all subscriptions mapped to corresponding pipes.
// List of all subscriptions mapped to corresponding pipes.
...
@@ -82,7 +83,7 @@ class radio_t : public socket_base_t
...
@@ -82,7 +83,7 @@ class radio_t : public socket_base_t
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
radio_t
)
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
radio_t
)
};
};
class
radio_session_t
:
public
session_base_t
class
radio_session_t
ZMQ_FINAL
:
public
session_base_t
{
{
public
:
public
:
radio_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
radio_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -90,12 +91,12 @@ class radio_session_t : public session_base_t
...
@@ -90,12 +91,12 @@ class radio_session_t : public session_base_t
zmq
::
socket_base_t
*
socket_
,
zmq
::
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
address_t
*
addr_
);
address_t
*
addr_
);
~
radio_session_t
();
~
radio_session_t
()
ZMQ_FINAL
;
// Overrides of the functions from session_base_t.
// Overrides of the functions from session_base_t.
int
push_msg
(
msg_t
*
msg_
);
int
push_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
;
int
pull_msg
(
msg_t
*
msg_
);
int
pull_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
;
void
reset
();
void
reset
()
ZMQ_FINAL
;
private
:
private
:
enum
enum
...
...
src/raw_decoder.hpp
View file @
628adf1c
...
@@ -39,22 +39,23 @@ namespace zmq
...
@@ -39,22 +39,23 @@ namespace zmq
{
{
// Decoder for 0MQ v1 framing protocol. Converts data stream into messages.
// Decoder for 0MQ v1 framing protocol. Converts data stream into messages.
class
raw_decoder_t
:
public
i_decoder
class
raw_decoder_t
ZMQ_FINAL
:
public
i_decoder
{
{
public
:
public
:
raw_decoder_t
(
size_t
bufsize_
);
raw_decoder_t
(
size_t
bufsize_
);
virtual
~
raw_decoder_t
()
;
~
raw_decoder_t
()
ZMQ_FINAL
;
// i_decoder interface.
// i_decoder interface.
v
irtual
void
get_buffer
(
unsigned
char
**
data_
,
size_t
*
size_
)
;
v
oid
get_buffer
(
unsigned
char
**
data_
,
size_t
*
size_
)
ZMQ_FINAL
;
virtual
int
int
decode
(
const
unsigned
char
*
data_
,
decode
(
const
unsigned
char
*
data_
,
size_t
size_
,
size_t
&
bytes_used_
);
size_t
size_
,
size_t
&
bytes_used_
)
ZMQ_FINAL
;
virtual
msg_t
*
msg
()
{
return
&
_in_progress
;
}
msg_t
*
msg
()
ZMQ_FINAL
{
return
&
_in_progress
;
}
v
irtual
void
resize_buffer
(
size_t
)
{}
v
oid
resize_buffer
(
size_t
)
ZMQ_FINAL
{}
private
:
private
:
msg_t
_in_progress
;
msg_t
_in_progress
;
...
...
src/raw_encoder.hpp
View file @
628adf1c
...
@@ -40,11 +40,11 @@ namespace zmq
...
@@ -40,11 +40,11 @@ namespace zmq
{
{
// Encoder for 0MQ framing protocol. Converts messages into data batches.
// Encoder for 0MQ framing protocol. Converts messages into data batches.
class
raw_encoder_t
:
public
encoder_base_t
<
raw_encoder_t
>
class
raw_encoder_t
ZMQ_FINAL
:
public
encoder_base_t
<
raw_encoder_t
>
{
{
public
:
public
:
raw_encoder_t
(
size_t
bufsize_
);
raw_encoder_t
(
size_t
bufsize_
);
~
raw_encoder_t
();
~
raw_encoder_t
()
ZMQ_FINAL
;
private
:
private
:
void
raw_message_ready
();
void
raw_message_ready
();
...
...
src/raw_engine.hpp
View file @
628adf1c
...
@@ -54,18 +54,18 @@ class mechanism_t;
...
@@ -54,18 +54,18 @@ class mechanism_t;
// This engine handles any socket with SOCK_STREAM semantics,
// This engine handles any socket with SOCK_STREAM semantics,
// e.g. TCP socket or an UNIX domain socket.
// e.g. TCP socket or an UNIX domain socket.
class
raw_engine_t
:
public
stream_engine_base_t
class
raw_engine_t
ZMQ_FINAL
:
public
stream_engine_base_t
{
{
public
:
public
:
raw_engine_t
(
fd_t
fd_
,
raw_engine_t
(
fd_t
fd_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
~
raw_engine_t
();
~
raw_engine_t
()
ZMQ_FINAL
;
protected
:
protected
:
void
error
(
error_reason_t
reason_
);
void
error
(
error_reason_t
reason_
)
ZMQ_FINAL
;
void
plug_internal
();
void
plug_internal
()
ZMQ_FINAL
;
bool
handshake
();
bool
handshake
()
ZMQ_FINAL
;
private
:
private
:
int
push_raw_msg_to_session
(
msg_t
*
msg_
);
int
push_raw_msg_to_session
(
msg_t
*
msg_
);
...
...
src/reaper.hpp
View file @
628adf1c
...
@@ -40,11 +40,11 @@ namespace zmq
...
@@ -40,11 +40,11 @@ namespace zmq
class
ctx_t
;
class
ctx_t
;
class
socket_base_t
;
class
socket_base_t
;
class
reaper_t
:
public
object_t
,
public
i_poll_events
class
reaper_t
ZMQ_FINAL
:
public
object_t
,
public
i_poll_events
{
{
public
:
public
:
reaper_t
(
zmq
::
ctx_t
*
ctx_
,
uint32_t
tid_
);
reaper_t
(
zmq
::
ctx_t
*
ctx_
,
uint32_t
tid_
);
~
reaper_t
();
~
reaper_t
()
ZMQ_FINAL
;
mailbox_t
*
get_mailbox
();
mailbox_t
*
get_mailbox
();
...
@@ -52,15 +52,15 @@ class reaper_t : public object_t, public i_poll_events
...
@@ -52,15 +52,15 @@ class reaper_t : public object_t, public i_poll_events
void
stop
();
void
stop
();
// i_poll_events implementation.
// i_poll_events implementation.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
private
:
private
:
// Command handlers.
// Command handlers.
void
process_stop
();
void
process_stop
()
ZMQ_FINAL
;
void
process_reap
(
zmq
::
socket_base_t
*
socket_
);
void
process_reap
(
zmq
::
socket_base_t
*
socket_
)
ZMQ_FINAL
;
void
process_reaped
();
void
process_reaped
()
ZMQ_FINAL
;
// Reaper thread accesses incoming commands via this mailbox.
// Reaper thread accesses incoming commands via this mailbox.
mailbox_t
_mailbox
;
mailbox_t
_mailbox
;
...
...
src/rep.hpp
View file @
628adf1c
...
@@ -39,17 +39,17 @@ class msg_t;
...
@@ -39,17 +39,17 @@ class msg_t;
class
io_thread_t
;
class
io_thread_t
;
class
socket_base_t
;
class
socket_base_t
;
class
rep_t
:
public
router_t
class
rep_t
ZMQ_FINAL
:
public
router_t
{
{
public
:
public
:
rep_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
rep_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
rep_t
();
~
rep_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
private
:
private
:
// If true, we are in process of sending the reply. If false we are
// If true, we are in process of sending the reply. If false we are
...
...
src/req.hpp
View file @
628adf1c
...
@@ -40,19 +40,20 @@ class msg_t;
...
@@ -40,19 +40,20 @@ class msg_t;
class
io_thread_t
;
class
io_thread_t
;
class
socket_base_t
;
class
socket_base_t
;
class
req_t
:
public
dealer_t
class
req_t
ZMQ_FINAL
:
public
dealer_t
{
{
public
:
public
:
req_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
req_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
req_t
();
~
req_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
protected
:
protected
:
// Receive only from the pipe the request was sent to, discarding
// Receive only from the pipe the request was sent to, discarding
...
@@ -86,7 +87,7 @@ class req_t : public dealer_t
...
@@ -86,7 +87,7 @@ class req_t : public dealer_t
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
req_t
)
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
req_t
)
};
};
class
req_session_t
:
public
session_base_t
class
req_session_t
ZMQ_FINAL
:
public
session_base_t
{
{
public
:
public
:
req_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
req_session_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -94,11 +95,11 @@ class req_session_t : public session_base_t
...
@@ -94,11 +95,11 @@ class req_session_t : public session_base_t
zmq
::
socket_base_t
*
socket_
,
zmq
::
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
address_t
*
addr_
);
address_t
*
addr_
);
~
req_session_t
();
~
req_session_t
()
ZMQ_FINAL
;
// Overrides of the functions from session_base_t.
// Overrides of the functions from session_base_t.
int
push_msg
(
msg_t
*
msg_
);
int
push_msg
(
msg_t
*
msg_
)
ZMQ_FINAL
;
void
reset
();
void
reset
()
ZMQ_FINAL
;
private
:
private
:
enum
enum
...
...
src/router.hpp
View file @
628adf1c
...
@@ -49,20 +49,22 @@ class router_t : public routing_socket_base_t
...
@@ -49,20 +49,22 @@ class router_t : public routing_socket_base_t
{
{
public
:
public
:
router_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
router_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
router_t
();
~
router_t
()
ZMQ_OVERRIDE
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
int
xsend
(
zmq
::
msg_t
*
msg_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
bool
xhas_in
();
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
bool
xhas_out
();
bool
xhas_in
()
ZMQ_OVERRIDE
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
bool
xhas_out
()
ZMQ_OVERRIDE
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
get_peer_state
(
const
void
*
routing_id_
,
size_t
routing_id_size_
)
const
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
get_peer_state
(
const
void
*
routing_id_
,
size_t
routing_id_size_
)
const
ZMQ_FINAL
;
protected
:
protected
:
// Rollback any message parts that were sent but not yet flushed.
// Rollback any message parts that were sent but not yet flushed.
...
...
src/scatter.hpp
View file @
628adf1c
...
@@ -41,21 +41,21 @@ class pipe_t;
...
@@ -41,21 +41,21 @@ class pipe_t;
class
msg_t
;
class
msg_t
;
class
io_thread_t
;
class
io_thread_t
;
class
scatter_t
:
public
socket_base_t
class
scatter_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
scatter_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
scatter_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
scatter_t
();
~
scatter_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Load balancer managing the outbound pipes.
// Load balancer managing the outbound pipes.
...
...
src/select.hpp
View file @
628adf1c
...
@@ -57,13 +57,13 @@ struct i_poll_events;
...
@@ -57,13 +57,13 @@ struct i_poll_events;
// Implements socket polling mechanism using POSIX.1-2001 select()
// Implements socket polling mechanism using POSIX.1-2001 select()
// function.
// function.
class
select_t
:
public
worker_poller_base_t
class
select_t
ZMQ_FINAL
:
public
worker_poller_base_t
{
{
public
:
public
:
typedef
fd_t
handle_t
;
typedef
fd_t
handle_t
;
select_t
(
const
thread_ctx_t
&
ctx_
);
select_t
(
const
thread_ctx_t
&
ctx_
);
~
select_t
();
~
select_t
()
ZMQ_FINAL
;
// "poller" concept.
// "poller" concept.
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
handle_t
add_fd
(
fd_t
fd_
,
zmq
::
i_poll_events
*
events_
);
...
@@ -78,7 +78,7 @@ class select_t : public worker_poller_base_t
...
@@ -78,7 +78,7 @@ class select_t : public worker_poller_base_t
private
:
private
:
// Main event loop.
// Main event loop.
void
loop
();
void
loop
()
ZMQ_FINAL
;
// Internal state.
// Internal state.
struct
fds_set_t
struct
fds_set_t
...
...
src/server.hpp
View file @
628adf1c
...
@@ -45,23 +45,23 @@ class msg_t;
...
@@ -45,23 +45,23 @@ class msg_t;
class
pipe_t
;
class
pipe_t
;
// TODO: This class uses O(n) scheduling. Rewrite it to use O(1) algorithm.
// TODO: This class uses O(n) scheduling. Rewrite it to use O(1) algorithm.
class
server_t
:
public
socket_base_t
class
server_t
ZMQ_FINAL
:
public
socket_base_t
{
{
public
:
public
:
server_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
server_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
server_t
();
~
server_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Fair queueing object for inbound pipes.
// Fair queueing object for inbound pipes.
...
...
src/session_base.hpp
View file @
628adf1c
...
@@ -65,10 +65,10 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
...
@@ -65,10 +65,10 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
void
engine_error
(
zmq
::
i_engine
::
error_reason_t
reason_
);
void
engine_error
(
zmq
::
i_engine
::
error_reason_t
reason_
);
// i_pipe_events interface implementation.
// i_pipe_events interface implementation.
void
read_activated
(
zmq
::
pipe_t
*
pipe_
);
void
read_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
write_activated
(
zmq
::
pipe_t
*
pipe_
);
void
write_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
hiccuped
(
zmq
::
pipe_t
*
pipe_
);
void
hiccuped
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
pipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
pipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
// Delivers a message. Returns 0 if successful; -1 otherwise.
// Delivers a message. Returns 0 if successful; -1 otherwise.
// The function takes ownership of the message.
// The function takes ownership of the message.
...
@@ -101,7 +101,7 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
...
@@ -101,7 +101,7 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
zmq
::
socket_base_t
*
socket_
,
zmq
::
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
address_t
*
addr_
);
address_t
*
addr_
);
virtual
~
session_base_t
()
;
~
session_base_t
()
ZMQ_OVERRIDE
;
private
:
private
:
void
start_connecting
(
bool
wait_
);
void
start_connecting
(
bool
wait_
);
...
@@ -138,12 +138,12 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
...
@@ -138,12 +138,12 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
void
reconnect
();
void
reconnect
();
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_plug
();
void
process_plug
()
ZMQ_FINAL
;
void
process_attach
(
zmq
::
i_engine
*
engine_
);
void
process_attach
(
zmq
::
i_engine
*
engine_
)
ZMQ_FINAL
;
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_FINAL
;
// i_poll_events handlers.
// i_poll_events handlers.
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
// Remove any half processed messages. Flush unflushed messages.
// Remove any half processed messages. Flush unflushed messages.
// Call this function when engine disconnect to get rid of leftovers.
// Call this function when engine disconnect to get rid of leftovers.
...
...
src/socket_base.hpp
View file @
628adf1c
...
@@ -107,15 +107,15 @@ class socket_base_t : public own_t,
...
@@ -107,15 +107,15 @@ class socket_base_t : public own_t,
// i_poll_events implementation. This interface is used when socket
// i_poll_events implementation. This interface is used when socket
// is handled by the poller in the reaper thread.
// is handled by the poller in the reaper thread.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
// i_pipe_events interface implementation.
// i_pipe_events interface implementation.
void
read_activated
(
pipe_t
*
pipe_
);
void
read_activated
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
write_activated
(
pipe_t
*
pipe_
);
void
write_activated
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
hiccuped
(
pipe_t
*
pipe_
);
void
hiccuped
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
pipe_terminated
(
pipe_t
*
pipe_
);
void
pipe_terminated
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
lock
();
void
lock
();
void
unlock
();
void
unlock
();
...
@@ -170,7 +170,7 @@ class socket_base_t : public own_t,
...
@@ -170,7 +170,7 @@ class socket_base_t : public own_t,
uint32_t
tid_
,
uint32_t
tid_
,
int
sid_
,
int
sid_
,
bool
thread_safe_
=
false
);
bool
thread_safe_
=
false
);
virtual
~
socket_base_t
()
;
~
socket_base_t
()
ZMQ_OVERRIDE
;
// Concrete algorithms for the x- methods are to be defined by
// Concrete algorithms for the x- methods are to be defined by
// individual socket types.
// individual socket types.
...
@@ -179,7 +179,7 @@ class socket_base_t : public own_t,
...
@@ -179,7 +179,7 @@ class socket_base_t : public own_t,
bool
locally_initiated_
=
false
)
=
0
;
bool
locally_initiated_
=
false
)
=
0
;
// The default implementation assumes there are no specific socket
// The default implementation assumes there are no specific socket
// options for the particular socket type. If not so,
override
this
// options for the particular socket type. If not so,
ZMQ_FINAL
this
// method.
// method.
virtual
int
virtual
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
...
@@ -203,7 +203,7 @@ class socket_base_t : public own_t,
...
@@ -203,7 +203,7 @@ class socket_base_t : public own_t,
virtual
int
xleave
(
const
char
*
group_
);
virtual
int
xleave
(
const
char
*
group_
);
// Delay actual destruction of the socket.
// Delay actual destruction of the socket.
void
process_destroy
();
void
process_destroy
()
ZMQ_FINAL
;
private
:
private
:
// test if event should be sent and then dispatch it
// test if event should be sent and then dispatch it
...
@@ -284,13 +284,14 @@ class socket_base_t : public own_t,
...
@@ -284,13 +284,14 @@ class socket_base_t : public own_t,
int
process_commands
(
int
timeout_
,
bool
throttle_
);
int
process_commands
(
int
timeout_
,
bool
throttle_
);
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_stop
();
void
process_stop
()
ZMQ_FINAL
;
void
process_bind
(
zmq
::
pipe_t
*
pipe_
);
void
process_bind
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
process_pipe_stats_publish
(
uint64_t
outbound_queue_count_
,
void
process_pipe_stats_publish
(
uint64_t
outbound_queue_count_
,
uint64_t
inbound_queue_count_
,
uint64_t
inbound_queue_count_
,
endpoint_uri_pair_t
*
endpoint_pair_
)
;
endpoint_uri_pair_t
*
endpoint_pair_
)
ZMQ_FINAL
;
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_FINAL
;
void
process_term_endpoint
(
std
::
string
*
endpoint_
);
void
process_term_endpoint
(
std
::
string
*
endpoint_
)
ZMQ_FINAL
;
void
update_pipe_options
(
int
option_
);
void
update_pipe_options
(
int
option_
);
...
@@ -348,12 +349,13 @@ class routing_socket_base_t : public socket_base_t
...
@@ -348,12 +349,13 @@ class routing_socket_base_t : public socket_base_t
{
{
protected
:
protected
:
routing_socket_base_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
routing_socket_base_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
routing_socket_base_t
();
~
routing_socket_base_t
()
ZMQ_OVERRIDE
;
// methods from socket_base_t
// methods from socket_base_t
virtual
int
int
xsetsockopt
(
int
option_
,
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
const
void
*
optval_
,
virtual
void
xwrite_activated
(
pipe_t
*
pipe_
);
size_t
optvallen_
)
ZMQ_OVERRIDE
;
void
xwrite_activated
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
// own methods
// own methods
std
::
string
extract_connect_routing_id
();
std
::
string
extract_connect_routing_id
();
...
...
src/socks_connecter.hpp
View file @
628adf1c
...
@@ -41,7 +41,7 @@ class io_thread_t;
...
@@ -41,7 +41,7 @@ class io_thread_t;
class
session_base_t
;
class
session_base_t
;
struct
address_t
;
struct
address_t
;
class
socks_connecter_t
:
public
stream_connecter_base_t
class
socks_connecter_t
ZMQ_FINAL
:
public
stream_connecter_base_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
@@ -52,7 +52,7 @@ class socks_connecter_t : public stream_connecter_base_t
...
@@ -52,7 +52,7 @@ class socks_connecter_t : public stream_connecter_base_t
address_t
*
addr_
,
address_t
*
addr_
,
address_t
*
proxy_addr_
,
address_t
*
proxy_addr_
,
bool
delayed_start_
);
bool
delayed_start_
);
~
socks_connecter_t
();
~
socks_connecter_t
()
ZMQ_FINAL
;
void
set_auth_method_basic
(
const
std
::
string
&
username
,
void
set_auth_method_basic
(
const
std
::
string
&
username
,
const
std
::
string
&
password
);
const
std
::
string
&
password
);
...
@@ -82,11 +82,11 @@ class socks_connecter_t : public stream_connecter_base_t
...
@@ -82,11 +82,11 @@ class socks_connecter_t : public stream_connecter_base_t
};
};
// Handlers for I/O events.
// Handlers for I/O events.
v
irtual
void
in_event
()
;
v
oid
in_event
()
ZMQ_FINAL
;
v
irtual
void
out_event
()
;
v
oid
out_event
()
ZMQ_FINAL
;
// Internal function to start the actual connection establishment.
// Internal function to start the actual connection establishment.
void
start_connecting
();
void
start_connecting
()
ZMQ_FINAL
;
int
process_server_response
(
const
socks_choice_t
&
response_
);
int
process_server_response
(
const
socks_choice_t
&
response_
);
int
process_server_response
(
const
socks_response_t
&
response_
);
int
process_server_response
(
const
socks_response_t
&
response_
);
...
...
src/stream.hpp
View file @
628adf1c
...
@@ -39,23 +39,24 @@ namespace zmq
...
@@ -39,23 +39,24 @@ namespace zmq
class
ctx_t
;
class
ctx_t
;
class
pipe_t
;
class
pipe_t
;
class
stream_t
:
public
routing_socket_base_t
class
stream_t
ZMQ_FINAL
:
public
routing_socket_base_t
{
{
public
:
public
:
stream_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
stream_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
stream_t
();
~
stream_t
()
ZMQ_FINAL
;
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
private
:
private
:
// Generate peer's id and update lookup map
// Generate peer's id and update lookup map
...
...
src/stream_connecter_base.hpp
View file @
628adf1c
...
@@ -51,16 +51,16 @@ class stream_connecter_base_t : public own_t, public io_object_t
...
@@ -51,16 +51,16 @@ class stream_connecter_base_t : public own_t, public io_object_t
address_t
*
addr_
,
address_t
*
addr_
,
bool
delayed_start_
);
bool
delayed_start_
);
~
stream_connecter_base_t
();
~
stream_connecter_base_t
()
ZMQ_OVERRIDE
;
protected
:
protected
:
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_plug
();
void
process_plug
()
ZMQ_FINAL
;
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_OVERRIDE
;
// Handlers for I/O events.
// Handlers for I/O events.
void
in_event
();
void
in_event
()
ZMQ_OVERRIDE
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_OVERRIDE
;
// Internal function to create the engine after connection was established.
// Internal function to create the engine after connection was established.
virtual
void
create_engine
(
fd_t
fd
,
const
std
::
string
&
local_address_
);
virtual
void
create_engine
(
fd_t
fd
,
const
std
::
string
&
local_address_
);
...
...
src/stream_engine_base.hpp
View file @
628adf1c
...
@@ -58,20 +58,21 @@ class stream_engine_base_t : public io_object_t, public i_engine
...
@@ -58,20 +58,21 @@ class stream_engine_base_t : public io_object_t, public i_engine
stream_engine_base_t
(
fd_t
fd_
,
stream_engine_base_t
(
fd_t
fd_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
~
stream_engine_base_t
();
~
stream_engine_base_t
()
ZMQ_OVERRIDE
;
// i_engine interface implementation.
// i_engine interface implementation.
void
plug
(
zmq
::
io_thread_t
*
io_thread_
,
zmq
::
session_base_t
*
session_
);
void
plug
(
zmq
::
io_thread_t
*
io_thread_
,
void
terminate
();
zmq
::
session_base_t
*
session_
)
ZMQ_FINAL
;
bool
restart_input
();
void
terminate
()
ZMQ_FINAL
;
void
restart_output
();
bool
restart_input
()
ZMQ_FINAL
;
void
zap_msg_available
();
void
restart_output
()
ZMQ_FINAL
;
const
endpoint_uri_pair_t
&
get_endpoint
()
const
;
void
zap_msg_available
()
ZMQ_FINAL
;
const
endpoint_uri_pair_t
&
get_endpoint
()
const
ZMQ_FINAL
;
// i_poll_events interface implementation.
// i_poll_events interface implementation.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
protected
:
protected
:
typedef
metadata_t
::
dict_t
properties_t
;
typedef
metadata_t
::
dict_t
properties_t
;
...
...
src/stream_listener_base.hpp
View file @
628adf1c
...
@@ -49,7 +49,7 @@ class stream_listener_base_t : public own_t, public io_object_t
...
@@ -49,7 +49,7 @@ class stream_listener_base_t : public own_t, public io_object_t
stream_listener_base_t
(
zmq
::
io_thread_t
*
io_thread_
,
stream_listener_base_t
(
zmq
::
io_thread_t
*
io_thread_
,
zmq
::
socket_base_t
*
socket_
,
zmq
::
socket_base_t
*
socket_
,
const
options_t
&
options_
);
const
options_t
&
options_
);
~
stream_listener_base_t
();
~
stream_listener_base_t
()
ZMQ_OVERRIDE
;
// Get the bound address for use with wildcards
// Get the bound address for use with wildcards
int
get_local_address
(
std
::
string
&
addr_
)
const
;
int
get_local_address
(
std
::
string
&
addr_
)
const
;
...
@@ -60,8 +60,8 @@ class stream_listener_base_t : public own_t, public io_object_t
...
@@ -60,8 +60,8 @@ class stream_listener_base_t : public own_t, public io_object_t
private
:
private
:
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_plug
();
void
process_plug
()
ZMQ_FINAL
;
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_FINAL
;
protected
:
protected
:
// Close the listening socket.
// Close the listening socket.
...
...
src/sub.hpp
View file @
628adf1c
...
@@ -39,16 +39,17 @@ class msg_t;
...
@@ -39,16 +39,17 @@ class msg_t;
class
io_thread_t
;
class
io_thread_t
;
class
socket_base_t
;
class
socket_base_t
;
class
sub_t
:
public
xsub_t
class
sub_t
ZMQ_FINAL
:
public
xsub_t
{
{
public
:
public
:
sub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
sub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
sub_t
();
~
sub_t
()
ZMQ_FINAL
;
protected
:
protected
:
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
int
xsend
(
zmq
::
msg_t
*
msg_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
bool
xhas_out
();
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
()
ZMQ_FINAL
;
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
sub_t
)
ZMQ_NON_COPYABLE_NOR_MOVABLE
(
sub_t
)
};
};
...
...
src/tcp_connecter.hpp
View file @
628adf1c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
namespace
zmq
namespace
zmq
{
{
class
tcp_connecter_t
:
public
stream_connecter_base_t
class
tcp_connecter_t
ZMQ_FINAL
:
public
stream_connecter_base_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
@@ -46,7 +46,7 @@ class tcp_connecter_t : public stream_connecter_base_t
...
@@ -46,7 +46,7 @@ class tcp_connecter_t : public stream_connecter_base_t
const
options_t
&
options_
,
const
options_t
&
options_
,
address_t
*
addr_
,
address_t
*
addr_
,
bool
delayed_start_
);
bool
delayed_start_
);
~
tcp_connecter_t
();
~
tcp_connecter_t
()
ZMQ_FINAL
;
private
:
private
:
// ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
// ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
...
@@ -56,14 +56,14 @@ class tcp_connecter_t : public stream_connecter_base_t
...
@@ -56,14 +56,14 @@ class tcp_connecter_t : public stream_connecter_base_t
};
};
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_FINAL
;
// Handlers for I/O events.
// Handlers for I/O events.
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
// Internal function to start the actual connection establishment.
// Internal function to start the actual connection establishment.
void
start_connecting
();
void
start_connecting
()
ZMQ_FINAL
;
// Internal function to add a connect timer
// Internal function to add a connect timer
void
add_connect_timer
();
void
add_connect_timer
();
...
...
src/tcp_listener.hpp
View file @
628adf1c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
namespace
zmq
namespace
zmq
{
{
class
tcp_listener_t
:
public
stream_listener_base_t
class
tcp_listener_t
ZMQ_FINAL
:
public
stream_listener_base_t
{
{
public
:
public
:
tcp_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
tcp_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -47,11 +47,12 @@ class tcp_listener_t : public stream_listener_base_t
...
@@ -47,11 +47,12 @@ class tcp_listener_t : public stream_listener_base_t
int
set_local_address
(
const
char
*
addr_
);
int
set_local_address
(
const
char
*
addr_
);
protected
:
protected
:
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
;
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
ZMQ_FINAL
;
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
// Accept the new connection. Returns the file descriptor of the
// Accept the new connection. Returns the file descriptor of the
// newly created connection. The function may return retired_fd
// newly created connection. The function may return retired_fd
...
...
src/tipc_connecter.hpp
View file @
628adf1c
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
namespace
zmq
namespace
zmq
{
{
class
tipc_connecter_t
:
public
stream_connecter_base_t
class
tipc_connecter_t
ZMQ_FINAL
:
public
stream_connecter_base_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
@@ -52,10 +52,10 @@ class tipc_connecter_t : public stream_connecter_base_t
...
@@ -52,10 +52,10 @@ class tipc_connecter_t : public stream_connecter_base_t
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
// Internal function to start the actual connection establishment.
// Internal function to start the actual connection establishment.
void
start_connecting
();
void
start_connecting
()
ZMQ_FINAL
;
// Get the file descriptor of newly created connection. Returns
// Get the file descriptor of newly created connection. Returns
// retired_fd if the connection was unsuccessful.
// retired_fd if the connection was unsuccessful.
...
...
src/tipc_listener.hpp
View file @
628adf1c
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
namespace
zmq
namespace
zmq
{
{
class
tipc_listener_t
:
public
stream_listener_base_t
class
tipc_listener_t
ZMQ_FINAL
:
public
stream_listener_base_t
{
{
public
:
public
:
tipc_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
tipc_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -53,11 +53,12 @@ class tipc_listener_t : public stream_listener_base_t
...
@@ -53,11 +53,12 @@ class tipc_listener_t : public stream_listener_base_t
int
set_local_address
(
const
char
*
addr_
);
int
set_local_address
(
const
char
*
addr_
);
protected
:
protected
:
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
;
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
ZMQ_FINAL
;
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
// Accept the new connection. Returns the file descriptor of the
// Accept the new connection. Returns the file descriptor of the
// newly created connection. The function may return retired_fd
// newly created connection. The function may return retired_fd
...
...
src/udp_engine.hpp
View file @
628adf1c
...
@@ -14,36 +14,37 @@ namespace zmq
...
@@ -14,36 +14,37 @@ namespace zmq
class
io_thread_t
;
class
io_thread_t
;
class
session_base_t
;
class
session_base_t
;
class
udp_engine_t
:
public
io_object_t
,
public
i_engine
class
udp_engine_t
ZMQ_FINAL
:
public
io_object_t
,
public
i_engine
{
{
public
:
public
:
udp_engine_t
(
const
options_t
&
options_
);
udp_engine_t
(
const
options_t
&
options_
);
~
udp_engine_t
();
~
udp_engine_t
()
ZMQ_FINAL
;
int
init
(
address_t
*
address_
,
bool
send_
,
bool
recv_
);
int
init
(
address_t
*
address_
,
bool
send_
,
bool
recv_
);
// i_engine interface implementation.
// i_engine interface implementation.
// Plug the engine to the session.
// Plug the engine to the session.
void
plug
(
zmq
::
io_thread_t
*
io_thread_
,
class
session_base_t
*
session_
);
void
plug
(
zmq
::
io_thread_t
*
io_thread_
,
class
session_base_t
*
session_
)
ZMQ_FINAL
;
// Terminate and deallocate the engine. Note that 'detached'
// Terminate and deallocate the engine. Note that 'detached'
// events are not fired on termination.
// events are not fired on termination.
void
terminate
();
void
terminate
()
ZMQ_FINAL
;
// This method is called by the session to signalise that more
// This method is called by the session to signalise that more
// messages can be written to the pipe.
// messages can be written to the pipe.
bool
restart_input
();
bool
restart_input
()
ZMQ_FINAL
;
// This method is called by the session to signalise that there
// This method is called by the session to signalise that there
// are messages to send available.
// are messages to send available.
void
restart_output
();
void
restart_output
()
ZMQ_FINAL
;
void
zap_msg_available
(){};
void
zap_msg_available
()
ZMQ_FINAL
{};
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
const
endpoint_uri_pair_t
&
get_endpoint
()
const
;
const
endpoint_uri_pair_t
&
get_endpoint
()
const
ZMQ_FINAL
;
private
:
private
:
int
resolve_raw_address
(
char
*
name_
,
size_t
length_
);
int
resolve_raw_address
(
char
*
name_
,
size_t
length_
);
...
...
src/v1_decoder.hpp
View file @
628adf1c
...
@@ -36,13 +36,13 @@ namespace zmq
...
@@ -36,13 +36,13 @@ namespace zmq
{
{
// Decoder for ZMTP/1.0 protocol. Converts data batches into messages.
// Decoder for ZMTP/1.0 protocol. Converts data batches into messages.
class
v1_decoder_t
:
public
decoder_base_t
<
v1_decoder_t
>
class
v1_decoder_t
ZMQ_FINAL
:
public
decoder_base_t
<
v1_decoder_t
>
{
{
public
:
public
:
v1_decoder_t
(
size_t
bufsize_
,
int64_t
maxmsgsize_
);
v1_decoder_t
(
size_t
bufsize_
,
int64_t
maxmsgsize_
);
~
v1_decoder_t
();
~
v1_decoder_t
()
ZMQ_FINAL
;
virtual
msg_t
*
msg
()
{
return
&
_in_progress
;
}
msg_t
*
msg
()
ZMQ_FINAL
{
return
&
_in_progress
;
}
private
:
private
:
int
one_byte_size_ready
(
unsigned
char
const
*
);
int
one_byte_size_ready
(
unsigned
char
const
*
);
...
...
src/v1_encoder.hpp
View file @
628adf1c
...
@@ -36,11 +36,11 @@ namespace zmq
...
@@ -36,11 +36,11 @@ namespace zmq
{
{
// Encoder for ZMTP/1.0 protocol. Converts messages into data batches.
// Encoder for ZMTP/1.0 protocol. Converts messages into data batches.
class
v1_encoder_t
:
public
encoder_base_t
<
v1_encoder_t
>
class
v1_encoder_t
ZMQ_FINAL
:
public
encoder_base_t
<
v1_encoder_t
>
{
{
public
:
public
:
v1_encoder_t
(
size_t
bufsize_
);
v1_encoder_t
(
size_t
bufsize_
);
~
v1_encoder_t
();
~
v1_encoder_t
()
ZMQ_FINAL
;
private
:
private
:
void
size_ready
();
void
size_ready
();
...
...
src/v2_decoder.hpp
View file @
628adf1c
...
@@ -38,15 +38,15 @@ namespace zmq
...
@@ -38,15 +38,15 @@ namespace zmq
// Decoder for ZMTP/2.x framing protocol. Converts data stream into messages.
// Decoder for ZMTP/2.x framing protocol. Converts data stream into messages.
// The class has to inherit from shared_message_memory_allocator because
// The class has to inherit from shared_message_memory_allocator because
// the base class calls allocate in its constructor.
// the base class calls allocate in its constructor.
class
v2_decoder_t
class
v2_decoder_t
ZMQ_FINAL
:
public
decoder_base_t
<
v2_decoder_t
,
shared_message_memory_allocator
>
:
public
decoder_base_t
<
v2_decoder_t
,
shared_message_memory_allocator
>
{
{
public
:
public
:
v2_decoder_t
(
size_t
bufsize_
,
int64_t
maxmsgsize_
,
bool
zero_copy_
);
v2_decoder_t
(
size_t
bufsize_
,
int64_t
maxmsgsize_
,
bool
zero_copy_
);
virtual
~
v2_decoder_t
()
;
~
v2_decoder_t
()
ZMQ_FINAL
;
// i_decoder interface.
// i_decoder interface.
virtual
msg_t
*
msg
()
{
return
&
_in_progress
;
}
msg_t
*
msg
()
ZMQ_FINAL
{
return
&
_in_progress
;
}
private
:
private
:
int
flags_ready
(
unsigned
char
const
*
);
int
flags_ready
(
unsigned
char
const
*
);
...
...
src/v2_encoder.hpp
View file @
628adf1c
...
@@ -36,11 +36,11 @@ namespace zmq
...
@@ -36,11 +36,11 @@ namespace zmq
{
{
// Encoder for 0MQ framing protocol. Converts messages into data stream.
// Encoder for 0MQ framing protocol. Converts messages into data stream.
class
v2_encoder_t
:
public
encoder_base_t
<
v2_encoder_t
>
class
v2_encoder_t
ZMQ_FINAL
:
public
encoder_base_t
<
v2_encoder_t
>
{
{
public
:
public
:
v2_encoder_t
(
size_t
bufsize_
);
v2_encoder_t
(
size_t
bufsize_
);
virtual
~
v2_encoder_t
()
;
~
v2_encoder_t
()
ZMQ_FINAL
;
private
:
private
:
void
size_ready
();
void
size_ready
();
...
...
src/vmci_connecter.hpp
View file @
628adf1c
...
@@ -46,7 +46,7 @@ class session_base_t;
...
@@ -46,7 +46,7 @@ class session_base_t;
struct
address_t
;
struct
address_t
;
// TODO consider refactoring this to derive from stream_connecter_base_t
// TODO consider refactoring this to derive from stream_connecter_base_t
class
vmci_connecter_t
:
public
own_t
,
public
io_object_t
class
vmci_connecter_t
ZMQ_FINAL
:
public
own_t
,
public
io_object_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
...
src/vmci_listener.hpp
View file @
628adf1c
...
@@ -47,7 +47,7 @@ class io_thread_t;
...
@@ -47,7 +47,7 @@ class io_thread_t;
class
socket_base_t
;
class
socket_base_t
;
// TODO consider refactoring this to derive from stream_listener_base_t
// TODO consider refactoring this to derive from stream_listener_base_t
class
vmci_listener_t
:
public
own_t
,
public
io_object_t
class
vmci_listener_t
ZMQ_FINAL
:
public
own_t
,
public
io_object_t
{
{
public
:
public
:
vmci_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
vmci_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
...
src/ws_connecter.hpp
View file @
628adf1c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
namespace
zmq
namespace
zmq
{
{
class
ws_connecter_t
:
public
stream_connecter_base_t
class
ws_connecter_t
ZMQ_FINAL
:
public
stream_connecter_base_t
{
{
public
:
public
:
// If 'delayed_start' is true connecter first waits for a while,
// If 'delayed_start' is true connecter first waits for a while,
...
@@ -48,10 +48,10 @@ class ws_connecter_t : public stream_connecter_base_t
...
@@ -48,10 +48,10 @@ class ws_connecter_t : public stream_connecter_base_t
bool
delayed_start_
,
bool
delayed_start_
,
bool
wss_
,
bool
wss_
,
const
std
::
string
&
tls_hostname_
);
const
std
::
string
&
tls_hostname_
);
~
ws_connecter_t
();
~
ws_connecter_t
()
ZMQ_FINAL
;
protected
:
protected
:
void
create_engine
(
fd_t
fd
,
const
std
::
string
&
local_address_
);
void
create_engine
(
fd_t
fd
,
const
std
::
string
&
local_address_
)
ZMQ_FINAL
;
private
:
private
:
// ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
// ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
...
@@ -61,14 +61,14 @@ class ws_connecter_t : public stream_connecter_base_t
...
@@ -61,14 +61,14 @@ class ws_connecter_t : public stream_connecter_base_t
};
};
// Handlers for incoming commands.
// Handlers for incoming commands.
void
process_term
(
int
linger_
);
void
process_term
(
int
linger_
)
ZMQ_FINAL
;
// Handlers for I/O events.
// Handlers for I/O events.
void
out_event
();
void
out_event
()
ZMQ_FINAL
;
void
timer_event
(
int
id_
);
void
timer_event
(
int
id_
)
ZMQ_FINAL
;
// Internal function to start the actual connection establishment.
// Internal function to start the actual connection establishment.
void
start_connecting
();
void
start_connecting
()
ZMQ_FINAL
;
// Internal function to add a connect timer
// Internal function to add a connect timer
void
add_connect_timer
();
void
add_connect_timer
();
...
...
src/ws_decoder.hpp
View file @
628adf1c
...
@@ -39,7 +39,7 @@ namespace zmq
...
@@ -39,7 +39,7 @@ namespace zmq
// Decoder for Web socket framing protocol. Converts data stream into messages.
// Decoder for Web socket framing protocol. Converts data stream into messages.
// The class has to inherit from shared_message_memory_allocator because
// The class has to inherit from shared_message_memory_allocator because
// the base class calls allocate in its constructor.
// the base class calls allocate in its constructor.
class
ws_decoder_t
class
ws_decoder_t
ZMQ_FINAL
:
public
decoder_base_t
<
ws_decoder_t
,
shared_message_memory_allocator
>
:
public
decoder_base_t
<
ws_decoder_t
,
shared_message_memory_allocator
>
{
{
public
:
public
:
...
@@ -47,10 +47,10 @@ class ws_decoder_t
...
@@ -47,10 +47,10 @@ class ws_decoder_t
int64_t
maxmsgsize_
,
int64_t
maxmsgsize_
,
bool
zero_copy_
,
bool
zero_copy_
,
bool
must_mask_
);
bool
must_mask_
);
virtual
~
ws_decoder_t
()
;
~
ws_decoder_t
()
ZMQ_FINAL
;
// i_decoder interface.
// i_decoder interface.
virtual
msg_t
*
msg
()
{
return
&
_in_progress
;
}
msg_t
*
msg
()
ZMQ_FINAL
{
return
&
_in_progress
;
}
private
:
private
:
int
opcode_ready
(
unsigned
char
const
*
);
int
opcode_ready
(
unsigned
char
const
*
);
...
...
src/ws_encoder.hpp
View file @
628adf1c
...
@@ -36,11 +36,11 @@ namespace zmq
...
@@ -36,11 +36,11 @@ namespace zmq
{
{
// Encoder for web socket framing protocol. Converts messages into data stream.
// Encoder for web socket framing protocol. Converts messages into data stream.
class
ws_encoder_t
:
public
encoder_base_t
<
ws_encoder_t
>
class
ws_encoder_t
ZMQ_FINAL
:
public
encoder_base_t
<
ws_encoder_t
>
{
{
public
:
public
:
ws_encoder_t
(
size_t
bufsize_
,
bool
must_mask_
);
ws_encoder_t
(
size_t
bufsize_
,
bool
must_mask_
);
virtual
~
ws_encoder_t
()
;
~
ws_encoder_t
()
ZMQ_FINAL
;
private
:
private
:
void
size_ready
();
void
size_ready
();
...
...
src/ws_engine.hpp
View file @
628adf1c
...
@@ -124,7 +124,7 @@ typedef enum
...
@@ -124,7 +124,7 @@ typedef enum
client_handshake_error
=
-
1
client_handshake_error
=
-
1
}
ws_client_handshake_state_t
;
}
ws_client_handshake_state_t
;
class
ws_engine_t
:
public
stream_engine_base_t
class
ws_engine_t
ZMQ_FINAL
:
public
stream_engine_base_t
{
{
public
:
public
:
ws_engine_t
(
fd_t
fd_
,
ws_engine_t
(
fd_t
fd_
,
...
@@ -132,7 +132,7 @@ class ws_engine_t : public stream_engine_base_t
...
@@ -132,7 +132,7 @@ class ws_engine_t : public stream_engine_base_t
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
,
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
,
ws_address_t
&
address_
,
ws_address_t
&
address_
,
bool
client_
);
bool
client_
);
~
ws_engine_t
();
~
ws_engine_t
()
ZMQ_FINAL
;
protected
:
protected
:
int
decode_and_push
(
msg_t
*
msg_
);
int
decode_and_push
(
msg_t
*
msg_
);
...
...
src/ws_listener.hpp
View file @
628adf1c
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
namespace
zmq
namespace
zmq
{
{
class
ws_listener_t
:
public
stream_listener_base_t
class
ws_listener_t
ZMQ_FINAL
:
public
stream_listener_base_t
{
{
public
:
public
:
ws_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
ws_listener_t
(
zmq
::
io_thread_t
*
io_thread_
,
...
@@ -48,18 +48,19 @@ class ws_listener_t : public stream_listener_base_t
...
@@ -48,18 +48,19 @@ class ws_listener_t : public stream_listener_base_t
const
options_t
&
options_
,
const
options_t
&
options_
,
bool
wss_
);
bool
wss_
);
~
ws_listener_t
();
~
ws_listener_t
()
ZMQ_FINAL
;
// Set address to listen on.
// Set address to listen on.
int
set_local_address
(
const
char
*
addr_
);
int
set_local_address
(
const
char
*
addr_
);
protected
:
protected
:
std
::
string
get_socket_name
(
fd_t
fd_
,
socket_end_t
socket_end_
)
const
;
std
::
string
get_socket_name
(
fd_t
fd_
,
void
create_engine
(
fd_t
fd
);
socket_end_t
socket_end_
)
const
ZMQ_FINAL
;
void
create_engine
(
fd_t
fd
)
ZMQ_FINAL
;
private
:
private
:
// Handlers for I/O events.
// Handlers for I/O events.
void
in_event
();
void
in_event
()
ZMQ_FINAL
;
// Accept the new connection. Returns the file descriptor of the
// Accept the new connection. Returns the file descriptor of the
// newly created connection. The function may return retired_fd
// newly created connection. The function may return retired_fd
...
...
src/xpub.hpp
View file @
628adf1c
...
@@ -48,20 +48,21 @@ class xpub_t : public socket_base_t
...
@@ -48,20 +48,21 @@ class xpub_t : public socket_base_t
{
{
public
:
public
:
xpub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
xpub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
xpub_t
();
~
xpub_t
()
ZMQ_OVERRIDE
;
// Implementations of virtual functions from socket_base_t.
// Implementations of virtual functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
=
false
,
bool
subscribe_to_all_
=
false
,
bool
locally_initiated_
=
false
);
bool
locally_initiated_
=
false
)
ZMQ_OVERRIDE
;
int
xsend
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
bool
xhas_out
();
bool
xhas_out
()
ZMQ_FINAL
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
bool
xhas_in
();
bool
xhas_in
()
ZMQ_OVERRIDE
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Function to be applied to the trie to send all the subscriptions
// Function to be applied to the trie to send all the subscriptions
...
...
src/xsub.hpp
View file @
628adf1c
...
@@ -50,22 +50,24 @@ class xsub_t : public socket_base_t
...
@@ -50,22 +50,24 @@ class xsub_t : public socket_base_t
{
{
public
:
public
:
xsub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
xsub_t
(
zmq
::
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
);
~
xsub_t
();
~
xsub_t
()
ZMQ_OVERRIDE
;
protected
:
protected
:
// Overrides of functions from socket_base_t.
// Overrides of functions from socket_base_t.
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
void
xattach_pipe
(
zmq
::
pipe_t
*
pipe_
,
bool
subscribe_to_all_
,
bool
subscribe_to_all_
,
bool
locally_initiated_
);
bool
locally_initiated_
)
ZMQ_FINAL
;
int
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
);
int
xsetsockopt
(
int
option_
,
int
xsend
(
zmq
::
msg_t
*
msg_
);
const
void
*
optval_
,
bool
xhas_out
();
size_t
optvallen_
)
ZMQ_OVERRIDE
;
int
xrecv
(
zmq
::
msg_t
*
msg_
);
int
xsend
(
zmq
::
msg_t
*
msg_
)
ZMQ_OVERRIDE
;
bool
xhas_in
();
bool
xhas_out
()
ZMQ_OVERRIDE
;
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
);
int
xrecv
(
zmq
::
msg_t
*
msg_
)
ZMQ_FINAL
;
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
);
bool
xhas_in
()
ZMQ_FINAL
;
void
xhiccuped
(
pipe_t
*
pipe_
);
void
xread_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
);
void
xwrite_activated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xhiccuped
(
pipe_t
*
pipe_
)
ZMQ_FINAL
;
void
xpipe_terminated
(
zmq
::
pipe_t
*
pipe_
)
ZMQ_FINAL
;
private
:
private
:
// Check whether the message matches at least one subscription.
// Check whether the message matches at least one subscription.
...
...
src/ypipe.hpp
View file @
628adf1c
...
@@ -43,7 +43,7 @@ namespace zmq
...
@@ -43,7 +43,7 @@ namespace zmq
// N is granularity of the pipe, i.e. how many items are needed to
// N is granularity of the pipe, i.e. how many items are needed to
// perform next memory allocation.
// perform next memory allocation.
template
<
typename
T
,
int
N
>
class
ypipe_t
:
public
ypipe_base_t
<
T
>
template
<
typename
T
,
int
N
>
class
ypipe_t
ZMQ_FINAL
:
public
ypipe_base_t
<
T
>
{
{
public
:
public
:
// Initialises the pipe.
// Initialises the pipe.
...
@@ -71,7 +71,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -71,7 +71,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
// set to true the item is assumed to be continued by items
// set to true the item is assumed to be continued by items
// subsequently written to the pipe. Incomplete items are never
// subsequently written to the pipe. Incomplete items are never
// flushed down the stream.
// flushed down the stream.
inline
void
write
(
const
T
&
value_
,
bool
incomplete_
)
inline
void
write
(
const
T
&
value_
,
bool
incomplete_
)
ZMQ_FINAL
{
{
// Place the value to the queue, add new terminator element.
// Place the value to the queue, add new terminator element.
_queue
.
back
()
=
value_
;
_queue
.
back
()
=
value_
;
...
@@ -88,7 +88,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -88,7 +88,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
// Pop an incomplete item from the pipe. Returns true if such
// Pop an incomplete item from the pipe. Returns true if such
// item exists, false otherwise.
// item exists, false otherwise.
inline
bool
unwrite
(
T
*
value_
)
inline
bool
unwrite
(
T
*
value_
)
ZMQ_FINAL
{
{
if
(
_f
==
&
_queue
.
back
())
if
(
_f
==
&
_queue
.
back
())
return
false
;
return
false
;
...
@@ -100,7 +100,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -100,7 +100,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
// Flush all the completed items into the pipe. Returns false if
// Flush all the completed items into the pipe. Returns false if
// the reader thread is sleeping. In that case, caller is obliged to
// the reader thread is sleeping. In that case, caller is obliged to
// wake the reader up before using the pipe again.
// wake the reader up before using the pipe again.
inline
bool
flush
()
inline
bool
flush
()
ZMQ_FINAL
{
{
// If there are no un-flushed items, do nothing.
// If there are no un-flushed items, do nothing.
if
(
_w
==
_f
)
if
(
_w
==
_f
)
...
@@ -125,7 +125,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -125,7 +125,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
}
}
// Check whether item is available for reading.
// Check whether item is available for reading.
inline
bool
check_read
()
inline
bool
check_read
()
ZMQ_FINAL
{
{
// Was the value prefetched already? If so, return.
// Was the value prefetched already? If so, return.
if
(
&
_queue
.
front
()
!=
_r
&&
_r
)
if
(
&
_queue
.
front
()
!=
_r
&&
_r
)
...
@@ -150,7 +150,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -150,7 +150,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
// Reads an item from the pipe. Returns false if there is no value.
// Reads an item from the pipe. Returns false if there is no value.
// available.
// available.
inline
bool
read
(
T
*
value_
)
inline
bool
read
(
T
*
value_
)
ZMQ_FINAL
{
{
// Try to prefetch a value.
// Try to prefetch a value.
if
(
!
check_read
())
if
(
!
check_read
())
...
@@ -166,7 +166,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
...
@@ -166,7 +166,7 @@ template <typename T, int N> class ypipe_t : public ypipe_base_t<T>
// Applies the function fn to the first elemenent in the pipe
// Applies the function fn to the first elemenent in the pipe
// and returns the value returned by the fn.
// and returns the value returned by the fn.
// The pipe mustn't be empty or the function crashes.
// The pipe mustn't be empty or the function crashes.
inline
bool
probe
(
bool
(
*
fn_
)
(
const
T
&
))
inline
bool
probe
(
bool
(
*
fn_
)
(
const
T
&
))
ZMQ_FINAL
{
{
bool
rc
=
check_read
();
bool
rc
=
check_read
();
zmq_assert
(
rc
);
zmq_assert
(
rc
);
...
...
src/ypipe_conflate.hpp
View file @
628adf1c
...
@@ -43,7 +43,7 @@ namespace zmq
...
@@ -43,7 +43,7 @@ namespace zmq
// reader_awake flag is needed here to mimic ypipe delicate behaviour
// reader_awake flag is needed here to mimic ypipe delicate behaviour
// around the reader being asleep (see 'c' pointer being NULL in ypipe.hpp)
// around the reader being asleep (see 'c' pointer being NULL in ypipe.hpp)
template
<
typename
T
>
class
ypipe_conflate_t
:
public
ypipe_base_t
<
T
>
template
<
typename
T
>
class
ypipe_conflate_t
ZMQ_FINAL
:
public
ypipe_base_t
<
T
>
{
{
public
:
public
:
// Initialises the pipe.
// Initialises the pipe.
...
@@ -57,7 +57,7 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
...
@@ -57,7 +57,7 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
#pragma message save
#pragma message save
#pragma message disable(UNINIT)
#pragma message disable(UNINIT)
#endif
#endif
inline
void
write
(
const
T
&
value_
,
bool
incomplete_
)
inline
void
write
(
const
T
&
value_
,
bool
incomplete_
)
ZMQ_FINAL
{
{
(
void
)
incomplete_
;
(
void
)
incomplete_
;
...
@@ -69,16 +69,16 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
...
@@ -69,16 +69,16 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
#endif
#endif
// There are no incomplete items for conflate ypipe
// There are no incomplete items for conflate ypipe
inline
bool
unwrite
(
T
*
)
{
return
false
;
}
inline
bool
unwrite
(
T
*
)
ZMQ_FINAL
{
return
false
;
}
// Flush is no-op for conflate ypipe. Reader asleep behaviour
// Flush is no-op for conflate ypipe. Reader asleep behaviour
// is as of the usual ypipe.
// is as of the usual ypipe.
// Returns false if the reader thread is sleeping. In that case,
// Returns false if the reader thread is sleeping. In that case,
// caller is obliged to wake the reader up before using the pipe again.
// caller is obliged to wake the reader up before using the pipe again.
inline
bool
flush
()
{
return
reader_awake
;
}
inline
bool
flush
()
ZMQ_FINAL
{
return
reader_awake
;
}
// Check whether item is available for reading.
// Check whether item is available for reading.
inline
bool
check_read
()
inline
bool
check_read
()
ZMQ_FINAL
{
{
bool
res
=
dbuffer
.
check_read
();
bool
res
=
dbuffer
.
check_read
();
if
(
!
res
)
if
(
!
res
)
...
@@ -89,7 +89,7 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
...
@@ -89,7 +89,7 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
// Reads an item from the pipe. Returns false if there is no value.
// Reads an item from the pipe. Returns false if there is no value.
// available.
// available.
inline
bool
read
(
T
*
value_
)
inline
bool
read
(
T
*
value_
)
ZMQ_FINAL
{
{
if
(
!
check_read
())
if
(
!
check_read
())
return
false
;
return
false
;
...
@@ -100,7 +100,10 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
...
@@ -100,7 +100,10 @@ template <typename T> class ypipe_conflate_t : public ypipe_base_t<T>
// Applies the function fn to the first elemenent in the pipe
// Applies the function fn to the first elemenent in the pipe
// and returns the value returned by the fn.
// and returns the value returned by the fn.
// The pipe mustn't be empty or the function crashes.
// The pipe mustn't be empty or the function crashes.
inline
bool
probe
(
bool
(
*
fn_
)
(
const
T
&
))
{
return
dbuffer
.
probe
(
fn_
);
}
inline
bool
probe
(
bool
(
*
fn_
)
(
const
T
&
))
ZMQ_FINAL
{
return
dbuffer
.
probe
(
fn_
);
}
protected
:
protected
:
dbuffer_t
<
T
>
dbuffer
;
dbuffer_t
<
T
>
dbuffer
;
...
...
src/zap_client.hpp
View file @
628adf1c
...
@@ -83,12 +83,12 @@ class zap_client_common_handshake_t : public zap_client_t
...
@@ -83,12 +83,12 @@ class zap_client_common_handshake_t : public zap_client_t
state_t
zap_reply_ok_state_
);
state_t
zap_reply_ok_state_
);
// methods from mechanism_t
// methods from mechanism_t
status_t
status
()
const
;
status_t
status
()
const
ZMQ_FINAL
;
int
zap_msg_available
();
int
zap_msg_available
()
ZMQ_FINAL
;
// zap_client_t methods
// zap_client_t methods
int
receive_and_process_zap_reply
();
int
receive_and_process_zap_reply
()
ZMQ_FINAL
;
void
handle_zap_status_code
();
void
handle_zap_status_code
()
ZMQ_FINAL
;
// Current FSM state
// Current FSM state
state_t
state
;
state_t
state
;
...
...
src/zmtp_engine.hpp
View file @
628adf1c
...
@@ -59,24 +59,24 @@ class mechanism_t;
...
@@ -59,24 +59,24 @@ class mechanism_t;
// This engine handles any socket with SOCK_STREAM semantics,
// This engine handles any socket with SOCK_STREAM semantics,
// e.g. TCP socket or an UNIX domain socket.
// e.g. TCP socket or an UNIX domain socket.
class
zmtp_engine_t
:
public
stream_engine_base_t
class
zmtp_engine_t
ZMQ_FINAL
:
public
stream_engine_base_t
{
{
public
:
public
:
zmtp_engine_t
(
fd_t
fd_
,
zmtp_engine_t
(
fd_t
fd_
,
const
options_t
&
options_
,
const
options_t
&
options_
,
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
const
endpoint_uri_pair_t
&
endpoint_uri_pair_
);
~
zmtp_engine_t
();
~
zmtp_engine_t
()
ZMQ_FINAL
;
protected
:
protected
:
// Detects the protocol used by the peer.
// Detects the protocol used by the peer.
bool
handshake
();
bool
handshake
()
ZMQ_FINAL
;
void
plug_internal
();
void
plug_internal
()
ZMQ_FINAL
;
int
process_command_message
(
msg_t
*
msg_
);
int
process_command_message
(
msg_t
*
msg_
)
ZMQ_FINAL
;
int
produce_ping_message
(
msg_t
*
msg_
);
int
produce_ping_message
(
msg_t
*
msg_
)
ZMQ_FINAL
;
int
process_heartbeat_message
(
msg_t
*
msg_
);
int
process_heartbeat_message
(
msg_t
*
msg_
)
ZMQ_FINAL
;
int
produce_pong_message
(
msg_t
*
msg_
);
int
produce_pong_message
(
msg_t
*
msg_
)
ZMQ_FINAL
;
private
:
private
:
// Receive the greeting from the peer.
// Receive the greeting from the peer.
...
...
unittests/unittest_ip_resolver.cpp
View file @
628adf1c
...
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
...
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <unity.h>
#include <unity.h>
#include "../src/macros.hpp"
#include "../tests/testutil.hpp"
#include "../tests/testutil.hpp"
#include "../tests/testutil_unity.hpp"
#include "../tests/testutil_unity.hpp"
#include "../unittests/unittest_resolver_common.hpp"
#include "../unittests/unittest_resolver_common.hpp"
...
@@ -39,7 +40,7 @@ void tearDown ()
...
@@ -39,7 +40,7 @@ void tearDown ()
{
{
}
}
class
test_ip_resolver_t
:
public
zmq
::
ip_resolver_t
class
test_ip_resolver_t
ZMQ_FINAL
:
public
zmq
::
ip_resolver_t
{
{
public
:
public
:
test_ip_resolver_t
(
zmq
::
ip_resolver_options_t
opts_
)
:
test_ip_resolver_t
(
zmq
::
ip_resolver_options_t
opts_
)
:
...
@@ -55,10 +56,10 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
...
@@ -55,10 +56,10 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
const
char
*
ipv6
;
const
char
*
ipv6
;
};
};
virtual
int
do_getaddrinfo
(
const
char
*
node_
,
int
do_getaddrinfo
(
const
char
*
node_
,
const
char
*
service_
,
const
char
*
service_
,
const
struct
addrinfo
*
hints_
,
const
struct
addrinfo
*
hints_
,
struct
addrinfo
**
res_
)
struct
addrinfo
**
res_
)
ZMQ_FINAL
{
{
static
const
struct
dns_lut_t
dns_lut
[]
=
{
static
const
struct
dns_lut_t
dns_lut
[]
=
{
{
"ip.zeromq.org"
,
"10.100.0.1"
,
"fdf5:d058:d656::1"
},
{
"ip.zeromq.org"
,
"10.100.0.1"
,
"fdf5:d058:d656::1"
},
...
@@ -105,7 +106,7 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
...
@@ -105,7 +106,7 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
return
zmq
::
ip_resolver_t
::
do_getaddrinfo
(
ip
,
NULL
,
&
ai
,
res_
);
return
zmq
::
ip_resolver_t
::
do_getaddrinfo
(
ip
,
NULL
,
&
ai
,
res_
);
}
}
virtual
unsigned
int
do_if_nametoindex
(
const
char
*
ifname_
)
unsigned
int
do_if_nametoindex
(
const
char
*
ifname_
)
ZMQ_FINAL
{
{
static
const
char
*
dummy_interfaces
[]
=
{
static
const
char
*
dummy_interfaces
[]
=
{
"lo0"
,
"lo0"
,
...
...
unittests/unittest_poller.cpp
View file @
628adf1c
...
@@ -63,7 +63,7 @@ struct test_events_t : zmq::i_poll_events
...
@@ -63,7 +63,7 @@ struct test_events_t : zmq::i_poll_events
(
void
)
_fd
;
(
void
)
_fd
;
}
}
v
irtual
void
in_event
()
v
oid
in_event
()
ZMQ_OVERRIDE
{
{
_poller
.
rm_fd
(
_handle
);
_poller
.
rm_fd
(
_handle
);
_handle
=
(
zmq
::
poller_t
::
handle_t
)
NULL
;
_handle
=
(
zmq
::
poller_t
::
handle_t
)
NULL
;
...
@@ -73,13 +73,13 @@ struct test_events_t : zmq::i_poll_events
...
@@ -73,13 +73,13 @@ struct test_events_t : zmq::i_poll_events
}
}
v
irtual
void
out_event
()
v
oid
out_event
()
ZMQ_OVERRIDE
{
{
// TODO
// TODO
}
}
v
irtual
void
timer_event
(
int
id_
)
v
oid
timer_event
(
int
id_
)
ZMQ_OVERRIDE
{
{
LIBZMQ_UNUSED
(
id_
);
LIBZMQ_UNUSED
(
id_
);
_poller
.
rm_fd
(
_handle
);
_poller
.
rm_fd
(
_handle
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment