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
29c8e30f
Commit
29c8e30f
authored
May 11, 2016
by
Hitster GTD
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1982 from Hugne/bug_1968
tipc: add support for address domain suffix
parents
4ad68e0d
f81ef1bc
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
18 deletions
+23
-18
tipc_address.cpp
src/tipc_address.cpp
+10
-5
test_connect_delay_tipc.cpp
tests/test_connect_delay_tipc.cpp
+5
-5
test_pair_tipc.cpp
tests/test_pair_tipc.cpp
+1
-1
test_reqrep_device_tipc.cpp
tests/test_reqrep_device_tipc.cpp
+2
-2
test_reqrep_tipc.cpp
tests/test_reqrep_tipc.cpp
+1
-1
test_shutdown_stress_tipc.cpp
tests/test_shutdown_stress_tipc.cpp
+1
-1
test_sub_forward_tipc.cpp
tests/test_sub_forward_tipc.cpp
+2
-2
test_term_endpoint_tipc.cpp
tests/test_term_endpoint_tipc.cpp
+1
-1
No files found.
src/tipc_address.cpp
View file @
29c8e30f
...
@@ -59,8 +59,16 @@ int zmq::tipc_address_t::resolve (const char *name)
...
@@ -59,8 +59,16 @@ int zmq::tipc_address_t::resolve (const char *name)
unsigned
int
type
=
0
;
unsigned
int
type
=
0
;
unsigned
int
lower
=
0
;
unsigned
int
lower
=
0
;
unsigned
int
upper
=
0
;
unsigned
int
upper
=
0
;
unsigned
int
z
=
1
,
c
=
0
,
n
=
0
;
char
eof
;
const
char
*
domain
;
const
int
res
=
sscanf
(
name
,
"{%u,%u,%u}"
,
&
type
,
&
lower
,
&
upper
);
const
int
res
=
sscanf
(
name
,
"{%u,%u,%u}"
,
&
type
,
&
lower
,
&
upper
);
/* Fetch optional domain suffix. */
if
((
domain
=
strchr
(
name
,
'@'
)))
{
if
(
sscanf
(
domain
,
"@%u.%u.%u%c"
,
&
z
,
&
c
,
&
n
,
&
eof
)
!=
3
)
return
EINVAL
;
}
if
(
res
==
3
)
if
(
res
==
3
)
goto
nameseq
;
goto
nameseq
;
else
else
...
@@ -69,10 +77,7 @@ int zmq::tipc_address_t::resolve (const char *name)
...
@@ -69,10 +77,7 @@ int zmq::tipc_address_t::resolve (const char *name)
address
.
addrtype
=
TIPC_ADDR_NAME
;
address
.
addrtype
=
TIPC_ADDR_NAME
;
address
.
addr
.
name
.
name
.
type
=
type
;
address
.
addr
.
name
.
name
.
type
=
type
;
address
.
addr
.
name
.
name
.
instance
=
lower
;
address
.
addr
.
name
.
name
.
instance
=
lower
;
/* Since we can't specify lookup domain when connecting
address
.
addr
.
name
.
domain
=
tipc_addr
(
z
,
c
,
n
);
* (and we're not sure that we want it to be configurable)
* Change from 'closest first' approach, to search entire zone */
address
.
addr
.
name
.
domain
=
tipc_addr
(
1
,
0
,
0
);
address
.
scope
=
0
;
address
.
scope
=
0
;
return
0
;
return
0
;
}
}
...
...
tests/test_connect_delay_tipc.cpp
View file @
29c8e30f
...
@@ -60,10 +60,10 @@ int main (void)
...
@@ -60,10 +60,10 @@ int main (void)
val
=
0
;
val
=
0
;
zmq_setsockopt
(
from
,
ZMQ_LINGER
,
&
val
,
sizeof
(
val
));
zmq_setsockopt
(
from
,
ZMQ_LINGER
,
&
val
,
sizeof
(
val
));
// This pipe will not connect
// This pipe will not connect
rc
=
zmq_connect
(
from
,
"tipc://{5556,0}"
);
rc
=
zmq_connect
(
from
,
"tipc://{5556,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// This pipe will
// This pipe will
rc
=
zmq_connect
(
from
,
"tipc://{6555,0}"
);
rc
=
zmq_connect
(
from
,
"tipc://{6555,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// We send 10 messages, 5 should just get stuck in the queue
// We send 10 messages, 5 should just get stuck in the queue
...
@@ -130,10 +130,10 @@ int main (void)
...
@@ -130,10 +130,10 @@ int main (void)
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Connect to the invalid socket
// Connect to the invalid socket
rc
=
zmq_connect
(
from
,
"tipc://{5561,0}"
);
rc
=
zmq_connect
(
from
,
"tipc://{5561,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Connect to the valid socket
// Connect to the valid socket
rc
=
zmq_connect
(
from
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
from
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Send 10 messages, all should be routed to the connected pipe
// Send 10 messages, all should be routed to the connected pipe
...
@@ -185,7 +185,7 @@ int main (void)
...
@@ -185,7 +185,7 @@ int main (void)
assert
(
rc
==
0
);
assert
(
rc
==
0
);
rc
=
zmq_bind
(
backend
,
"tipc://{5560,0,0}"
);
rc
=
zmq_bind
(
backend
,
"tipc://{5560,0,0}"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
rc
=
zmq_connect
(
frontend
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
frontend
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Ping backend to frontend so we know when the connection is up
// Ping backend to frontend so we know when the connection is up
...
...
tests/test_pair_tipc.cpp
View file @
29c8e30f
...
@@ -44,7 +44,7 @@ int main (void)
...
@@ -44,7 +44,7 @@ int main (void)
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sc
);
assert
(
sc
);
rc
=
zmq_connect
(
sc
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
sc
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
bounce
(
sb
,
sc
);
bounce
(
sb
,
sc
);
...
...
tests/test_reqrep_device_tipc.cpp
View file @
29c8e30f
...
@@ -49,13 +49,13 @@ int main (void)
...
@@ -49,13 +49,13 @@ int main (void)
// Create a worker.
// Create a worker.
void
*
rep
=
zmq_socket
(
ctx
,
ZMQ_REP
);
void
*
rep
=
zmq_socket
(
ctx
,
ZMQ_REP
);
assert
(
rep
);
assert
(
rep
);
rc
=
zmq_connect
(
rep
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
rep
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Create a client.
// Create a client.
void
*
req
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
void
*
req
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
req
);
assert
(
req
);
rc
=
zmq_connect
(
req
,
"tipc://{5561,0}"
);
rc
=
zmq_connect
(
req
,
"tipc://{5561,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Send a request.
// Send a request.
...
...
tests/test_reqrep_tipc.cpp
View file @
29c8e30f
...
@@ -43,7 +43,7 @@ int main (void)
...
@@ -43,7 +43,7 @@ int main (void)
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
sc
);
assert
(
sc
);
rc
=
zmq_connect
(
sc
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
sc
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
bounce
(
sb
,
sc
);
bounce
(
sb
,
sc
);
...
...
tests/test_shutdown_stress_tipc.cpp
View file @
29c8e30f
...
@@ -37,7 +37,7 @@ extern "C"
...
@@ -37,7 +37,7 @@ extern "C"
{
{
int
rc
;
int
rc
;
rc
=
zmq_connect
(
s
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
s
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Start closing the socket while the connecting process is underway.
// Start closing the socket while the connecting process is underway.
...
...
tests/test_sub_forward_tipc.cpp
View file @
29c8e30f
...
@@ -49,13 +49,13 @@ int main (void)
...
@@ -49,13 +49,13 @@ int main (void)
// Create a publisher.
// Create a publisher.
void
*
pub
=
zmq_socket
(
ctx
,
ZMQ_PUB
);
void
*
pub
=
zmq_socket
(
ctx
,
ZMQ_PUB
);
assert
(
pub
);
assert
(
pub
);
rc
=
zmq_connect
(
pub
,
"tipc://{5561,0}"
);
rc
=
zmq_connect
(
pub
,
"tipc://{5561,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Create a subscriber.
// Create a subscriber.
void
*
sub
=
zmq_socket
(
ctx
,
ZMQ_SUB
);
void
*
sub
=
zmq_socket
(
ctx
,
ZMQ_SUB
);
assert
(
sub
);
assert
(
sub
);
rc
=
zmq_connect
(
sub
,
"tipc://{5560,0}"
);
rc
=
zmq_connect
(
sub
,
"tipc://{5560,0}
@0.0.0
"
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
// Subscribe for all messages.
// Subscribe for all messages.
...
...
tests/test_term_endpoint_tipc.cpp
View file @
29c8e30f
...
@@ -34,7 +34,7 @@ int main (void)
...
@@ -34,7 +34,7 @@ int main (void)
int
rc
;
int
rc
;
char
buf
[
32
];
char
buf
[
32
];
const
char
*
ep
=
"tipc://{5560,0,0}"
;
const
char
*
ep
=
"tipc://{5560,0,0}"
;
const
char
*
name
=
"tipc://{5560,0}"
;
const
char
*
name
=
"tipc://{5560,0}
@0.0.0
"
;
fprintf
(
stderr
,
"unbind endpoint test running...
\n
"
);
fprintf
(
stderr
,
"unbind endpoint test running...
\n
"
);
...
...
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