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
4d640fe0
Commit
4d640fe0
authored
May 06, 2014
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1012 from hurtonm/master
Update mechanism API so we can check for ERROR status
parents
8672f302
43d82524
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
49 additions
and
34 deletions
+49
-34
curve_client.cpp
src/curve_client.cpp
+2
-2
curve_client.hpp
src/curve_client.hpp
+1
-1
curve_server.cpp
src/curve_server.cpp
+2
-2
curve_server.hpp
src/curve_server.hpp
+1
-1
gssapi_client.cpp
src/gssapi_client.cpp
+2
-2
gssapi_client.hpp
src/gssapi_client.hpp
+1
-1
gssapi_server.cpp
src/gssapi_server.cpp
+2
-2
gssapi_server.hpp
src/gssapi_server.hpp
+1
-1
mechanism.hpp
src/mechanism.hpp
+8
-2
null_mechanism.cpp
src/null_mechanism.cpp
+5
-2
null_mechanism.hpp
src/null_mechanism.hpp
+1
-1
plain_mechanism.cpp
src/plain_mechanism.cpp
+2
-2
plain_mechanism.hpp
src/plain_mechanism.hpp
+1
-1
stream_engine.cpp
src/stream_engine.cpp
+20
-14
No files found.
src/curve_client.cpp
View file @
4d640fe0
...
...
@@ -206,9 +206,9 @@ int zmq::curve_client_t::decode (msg_t *msg_)
return
rc
;
}
bool
zmq
::
curve_client_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
curve_client_t
::
status
()
const
{
return
state
==
connected
;
return
state
==
connected
?
mechanism_t
::
ready
:
mechanism_t
::
handshaking
;
}
int
zmq
::
curve_client_t
::
produce_hello
(
msg_t
*
msg_
)
...
...
src/curve_client.hpp
View file @
4d640fe0
...
...
@@ -59,7 +59,7 @@ namespace zmq
virtual
int
process_handshake_command
(
msg_t
*
msg_
);
virtual
int
encode
(
msg_t
*
msg_
);
virtual
int
decode
(
msg_t
*
msg_
);
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/curve_server.cpp
View file @
4d640fe0
...
...
@@ -237,9 +237,9 @@ int zmq::curve_server_t::zap_msg_available ()
return
rc
;
}
bool
zmq
::
curve_server_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
curve_server_t
::
status
()
const
{
return
state
==
connected
;
return
state
==
connected
?
mechanism_t
::
ready
:
mechanism_t
::
handshaking
;
}
int
zmq
::
curve_server_t
::
process_hello
(
msg_t
*
msg_
)
...
...
src/curve_server.hpp
View file @
4d640fe0
...
...
@@ -64,7 +64,7 @@ namespace zmq
virtual
int
encode
(
msg_t
*
msg_
);
virtual
int
decode
(
msg_t
*
msg_
);
virtual
int
zap_msg_available
();
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/gssapi_client.cpp
View file @
4d640fe0
...
...
@@ -153,9 +153,9 @@ int zmq::gssapi_client_t::decode (msg_t *msg_)
return
0
;
}
bool
zmq
::
gssapi_client_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
gssapi_client_t
::
status
()
const
{
return
state
==
connected
;
return
state
==
connected
?
mechanism_t
::
ready
:
mechanism_t
::
handshaking
;
}
int
zmq
::
gssapi_client_t
::
initialize_context
()
...
...
src/gssapi_client.hpp
View file @
4d640fe0
...
...
@@ -42,7 +42,7 @@ namespace zmq
virtual
int
process_handshake_command
(
msg_t
*
msg_
);
virtual
int
encode
(
msg_t
*
msg_
);
virtual
int
decode
(
msg_t
*
msg_
);
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/gssapi_server.cpp
View file @
4d640fe0
...
...
@@ -315,9 +315,9 @@ int zmq::gssapi_server_t::zap_msg_available ()
return
rc
;
}
bool
zmq
::
gssapi_server_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
gssapi_server_t
::
status
()
const
{
return
state
==
connected
;
return
state
==
connected
?
mechanism_t
::
ready
:
mechanism_t
::
handshaking
;
}
int
zmq
::
gssapi_server_t
::
produce_next_token
(
msg_t
*
msg_
)
...
...
src/gssapi_server.hpp
View file @
4d640fe0
...
...
@@ -46,7 +46,7 @@ namespace zmq
virtual
int
encode
(
msg_t
*
msg_
);
virtual
int
decode
(
msg_t
*
msg_
);
virtual
int
zap_msg_available
();
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/mechanism.hpp
View file @
4d640fe0
...
...
@@ -37,6 +37,12 @@ namespace zmq
{
public
:
enum
status_t
{
handshaking
,
ready
,
error
};
mechanism_t
(
const
options_t
&
options_
);
virtual
~
mechanism_t
();
...
...
@@ -54,8 +60,8 @@ namespace zmq
// Notifies mechanism about availability of ZAP message.
virtual
int
zap_msg_available
()
{
return
0
;
}
//
True iff the handshake stage is complete?
virtual
bool
is_handshake_complete
()
const
=
0
;
//
Returns the status of this mechanism.
virtual
status_t
status
()
const
=
0
;
void
set_peer_identity
(
const
void
*
id_ptr
,
size_t
id_size
);
...
...
src/null_mechanism.cpp
View file @
4d640fe0
...
...
@@ -152,9 +152,12 @@ int zmq::null_mechanism_t::zap_msg_available ()
return
rc
;
}
bool
zmq
::
null_mechanism_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
null_mechanism_t
::
status
()
const
{
return
ready_command_received
&&
ready_command_sent
;
if
(
ready_command_received
&&
ready_command_sent
)
return
mechanism_t
::
ready
;
else
return
mechanism_t
::
handshaking
;
}
void
zmq
::
null_mechanism_t
::
send_zap_request
()
...
...
src/null_mechanism.hpp
View file @
4d640fe0
...
...
@@ -42,7 +42,7 @@ namespace zmq
virtual
int
next_handshake_command
(
msg_t
*
msg_
);
virtual
int
process_handshake_command
(
msg_t
*
msg_
);
virtual
int
zap_msg_available
();
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/plain_mechanism.cpp
View file @
4d640fe0
...
...
@@ -118,9 +118,9 @@ int zmq::plain_mechanism_t::process_handshake_command (msg_t *msg_)
return
rc
;
}
bool
zmq
::
plain_mechanism_t
::
is_handshake_complete
()
const
zmq
::
mechanism_t
::
status_t
zmq
::
plain_mechanism_t
::
status
()
const
{
return
state
==
ready
;
return
state
==
ready
?
mechanism_t
::
ready
:
mechanism_t
::
handshaking
;
}
int
zmq
::
plain_mechanism_t
::
zap_msg_available
()
...
...
src/plain_mechanism.hpp
View file @
4d640fe0
...
...
@@ -42,7 +42,7 @@ namespace zmq
virtual
int
next_handshake_command
(
msg_t
*
msg_
);
virtual
int
process_handshake_command
(
msg_t
*
msg_
);
virtual
int
zap_msg_available
();
virtual
bool
is_handshake_complete
()
const
;
virtual
status_t
status
()
const
;
private
:
...
...
src/stream_engine.cpp
View file @
4d640fe0
...
...
@@ -670,17 +670,21 @@ int zmq::stream_engine_t::next_handshake_command (msg_t *msg_)
{
zmq_assert
(
mechanism
!=
NULL
);
const
int
rc
=
mechanism
->
next_handshake_command
(
msg_
);
if
(
rc
==
0
)
{
msg_
->
set_flags
(
msg_t
::
command
);
if
(
mechanism
->
is_handshake_complete
())
mechanism_ready
();
if
(
mechanism
->
status
()
==
mechanism_t
::
ready
)
{
mechanism_ready
();
return
pull_and_encode
(
msg_
);
}
else
if
(
mechanism
->
status
()
==
mechanism_t
::
error
)
{
errno
=
EPROTO
;
return
-
1
;
}
else
{
const
int
rc
=
mechanism
->
next_handshake_command
(
msg_
);
if
(
rc
==
0
)
msg_
->
set_flags
(
msg_t
::
command
);
return
rc
;
}
// TODO:
// if (errno == EPROTO || errno == EACCES)
// return ERROR command to client
return
rc
;
}
int
zmq
::
stream_engine_t
::
process_handshake_command
(
msg_t
*
msg_
)
...
...
@@ -688,14 +692,16 @@ int zmq::stream_engine_t::process_handshake_command (msg_t *msg_)
zmq_assert
(
mechanism
!=
NULL
);
const
int
rc
=
mechanism
->
process_handshake_command
(
msg_
);
if
(
rc
==
0
)
{
if
(
mechanism
->
is_handshake_complete
()
)
if
(
mechanism
->
status
()
==
mechanism_t
::
ready
)
mechanism_ready
();
else
if
(
mechanism
->
status
()
==
mechanism_t
::
error
)
{
errno
=
EPROTO
;
return
-
1
;
}
if
(
output_stopped
)
restart_output
();
}
// TODO:
// if (errno == EPROTO || errno == EACCES)
// return ERROR command to client
return
rc
;
}
...
...
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