diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/nng/nng.h | 79 | ||||
| -rw-r--r-- | include/nng/protocol/bus0/bus.h | 30 | ||||
| -rw-r--r-- | include/nng/protocol/pair0/pair.h | 25 | ||||
| -rw-r--r-- | include/nng/protocol/pair1/pair.h | 31 | ||||
| -rw-r--r-- | include/nng/protocol/pipeline0/pull.h | 24 | ||||
| -rw-r--r-- | include/nng/protocol/pipeline0/push.h | 24 | ||||
| -rw-r--r-- | include/nng/protocol/pubsub0/pub.h | 24 | ||||
| -rw-r--r-- | include/nng/protocol/pubsub0/sub.h | 36 | ||||
| -rw-r--r-- | include/nng/protocol/reqrep0/rep.h | 29 | ||||
| -rw-r--r-- | include/nng/protocol/reqrep0/req.h | 30 | ||||
| -rw-r--r-- | include/nng/protocol/survey0/respond.h | 29 | ||||
| -rw-r--r-- | include/nng/protocol/survey0/survey.h | 31 |
12 files changed, 99 insertions, 293 deletions
diff --git a/include/nng/nng.h b/include/nng/nng.h index 16fcf51b..a3dafb7a 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -1608,6 +1608,57 @@ NNG_DECL int nng_tls_config_psk( NNG_DECL int nng_tls_config_version( nng_tls_config *, nng_tls_version, nng_tls_version); +// Protocol specific values. These were formerly located in protocol specific +// headers, but we are bringing them here for ease of use. + +// BUS0 +NNG_DECL int nng_bus0_open(nng_socket *); +NNG_DECL int nng_bus0_open_raw(nng_socket *); + +// PAIR0 +NNG_DECL int nng_pair0_open(nng_socket *); +NNG_DECL int nng_pair0_open_raw(nng_socket *); + +// PAIR1 +NNG_DECL int nng_pair1_open(nng_socket *); +NNG_DECL int nng_pair1_open_raw(nng_socket *); +NNG_DECL int nng_pair1_open_poly(nng_socket *); +#define NNG_OPT_PAIR1_POLY "pair1:polyamorous" + +// PIPELINE0 +NNG_DECL int nng_pull0_open(nng_socket *); +NNG_DECL int nng_pull0_open_raw(nng_socket *); +NNG_DECL int nng_push0_open(nng_socket *); +NNG_DECL int nng_push0_open_raw(nng_socket *); + +// PUBSUB0 +NNG_DECL int nng_pub0_open(nng_socket *); +NNG_DECL int nng_pub0_open_raw(nng_socket *); +NNG_DECL int nng_sub0_open(nng_socket *); +NNG_DECL int nng_sub0_open_raw(nng_socket *); +NNG_DECL int nng_sub0_socket_subscribe( + nng_socket id, const void *buf, size_t sz); +NNG_DECL int nng_sub0_socket_unsubscribe( + nng_socket id, const void *buf, size_t sz); +NNG_DECL int nng_sub0_ctx_subscribe(nng_ctx id, const void *buf, size_t sz); +NNG_DECL int nng_sub0_ctx_unsubscribe(nng_ctx id, const void *buf, size_t sz); +#define NNG_OPT_SUB_PREFNEW "sub:prefnew" + +// REQREP0 +NNG_DECL int nng_rep0_open(nng_socket *); +NNG_DECL int nng_rep0_open_raw(nng_socket *); +NNG_DECL int nng_req0_open(nng_socket *); +NNG_DECL int nng_req0_open_raw(nng_socket *); +#define NNG_OPT_REQ_RESENDTIME "req:resend-time" +#define NNG_OPT_REQ_RESENDTICK "req:resend-tick" + +// SURVEY0 +NNG_DECL int nng_respondent0_open(nng_socket *); +NNG_DECL int nng_respondent0_open_raw(nng_socket *); +NNG_DECL int nng_surveyor0_open(nng_socket *); +NNG_DECL int nng_surveyor0_open_raw(nng_socket *); +#define NNG_OPT_SURVEYOR_SURVEYTIME "surveyor:survey-time" + // These transition macros may help with migration from NNG1. // Applications should try to avoid depending on these any longer than // necessary, as they may be removed in a future update. This is far from a @@ -1623,7 +1674,31 @@ NNG_DECL int nng_tls_config_version( #define nng_ws_register() nng_nop() #define nng_wss_register() nng_nop() #define nng_zt_register() nng_nop() -#endif + +// protocol "wrappers" -- applications should just be using the version +// specific macros +#define nng_bus_open nng_bus0_open +#define nng_bus_open_raw nng_bus0_open_raw +#define nng_pair_open nng_pair1_open +#define nng_pair_open_raw nng_pair1_open_raw +#define nng_pull_open nng_pull0_open +#define nng_pull_open_raw nng_pull0_open_raw +#define nng_push_open nng_push0_open +#define nng_push_open_raw nng_push0_open_raw +#define nng_pub_open nng_pub0_open +#define nng_pub_open_raw nng_pub0_open_raw +#define nng_sub_open nng_sub0_open +#define nng_sub_open_raw nng_sub0_open_raw +#define nng_rep_open nng_rep0_open +#define nng_rep_open_raw nng_rep0_open_raw +#define nng_req_open nng_req0_open +#define nng_req_open_raw nng_req0_open_raw +#define nng_respondent_open nng_respondent0_open +#define nng_respondent_open_raw nng_respondent0_open_raw +#define nng_surveyor_open nng_surveyor0_open +#define nng_surveyor_open_raw nng_surveyor0_open_raw + +#endif // NNG1_TRANSITION #ifdef __cplusplus } diff --git a/include/nng/protocol/bus0/bus.h b/include/nng/protocol/bus0/bus.h index 31167d75..6d579dc7 100644 --- a/include/nng/protocol/bus0/bus.h +++ b/include/nng/protocol/bus0/bus.h @@ -1,6 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,32 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_BUS0_BUS_H #define NNG_PROTOCOL_BUS0_BUS_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_bus0_open(nng_socket *); - -NNG_DECL int nng_bus0_open_raw(nng_socket *); - -#ifndef nng_bus_open -#define nng_bus_open nng_bus0_open #endif - -#ifndef nng_bus_open_raw -#define nng_bus_open_raw nng_bus0_open_raw -#endif - -#define NNG_BUS0_SELF 0x70 -#define NNG_BUS0_PEER 0x70 -#define NNG_BUS0_SELF_NAME "bus" -#define NNG_BUS0_PEER_NAME "bus" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_BUS0_BUS_H diff --git a/include/nng/protocol/pair0/pair.h b/include/nng/protocol/pair0/pair.h index 1356f1cd..ec9c39ae 100644 --- a/include/nng/protocol/pair0/pair.h +++ b/include/nng/protocol/pair0/pair.h @@ -1,6 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,27 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PAIR0_PAIR_H #define NNG_PROTOCOL_PAIR0_PAIR_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_pair0_open(nng_socket *); - -NNG_DECL int nng_pair0_open_raw(nng_socket *); - -#ifndef nng_pair_open -#define nng_pair_open nng_pair0_open #endif - -#ifndef nng_pair_open_raw -#define nng_pair_open_raw nng_pair0_open_raw -#endif - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PAIR0_PAIR_H diff --git a/include/nng/protocol/pair1/pair.h b/include/nng/protocol/pair1/pair.h index c48b2021..4450c280 100644 --- a/include/nng/protocol/pair1/pair.h +++ b/include/nng/protocol/pair1/pair.h @@ -1,6 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,33 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PAIR1_PAIR_H #define NNG_PROTOCOL_PAIR1_PAIR_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_pair1_open(nng_socket *); -NNG_DECL int nng_pair1_open_raw(nng_socket *); -NNG_DECL int nng_pair1_open_poly(nng_socket *); - -#ifndef nng_pair_open -#define nng_pair_open nng_pair1_open -#endif - -#ifndef nng_pair_open_raw -#define nng_pair_open_raw nng_pair1_open_raw #endif - -#define NNG_OPT_PAIR1_POLY "pair1:polyamorous" -#define NNG_PAIR1_SELF 0x11 -#define NNG_PAIR1_PEER 0x11 -#define NNG_PAIR1_SELF_NAME "pair1" -#define NNG_PAIR1_PEER_NAME "pair1" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PAIR1_PAIR_H diff --git a/include/nng/protocol/pipeline0/pull.h b/include/nng/protocol/pipeline0/pull.h index 1c5d63e3..6f1c4621 100644 --- a/include/nng/protocol/pipeline0/pull.h +++ b/include/nng/protocol/pipeline0/pull.h @@ -1,6 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,26 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PIPELINE0_PULL_H #define NNG_PROTOCOL_PIPELINE0_PULL_H - -#ifdef __cplusplus -extern "C" { #endif - -NNG_DECL int nng_pull0_open(nng_socket *); -NNG_DECL int nng_pull0_open_raw(nng_socket *); - -#ifndef nng_pull_open -#define nng_pull_open nng_pull0_open -#endif - -#ifndef nng_pull_open_raw -#define nng_pull_open_raw nng_pull0_open_raw -#endif - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PIPELINE0_PULL_H diff --git a/include/nng/protocol/pipeline0/push.h b/include/nng/protocol/pipeline0/push.h index a1384e0a..25e37fd7 100644 --- a/include/nng/protocol/pipeline0/push.h +++ b/include/nng/protocol/pipeline0/push.h @@ -1,6 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,26 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PIPELINE0_PUSH_H #define NNG_PROTOCOL_PIPELINE0_PUSH_H - -#ifdef __cplusplus -extern "C" { #endif - -NNG_DECL int nng_push0_open(nng_socket *); -NNG_DECL int nng_push0_open_raw(nng_socket *); - -#ifndef nng_push_open -#define nng_push_open nng_push0_open -#endif - -#ifndef nng_push_open_raw -#define nng_push_open_raw nng_push0_open_raw -#endif - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PIPELINE0_PUSH_H diff --git a/include/nng/protocol/pubsub0/pub.h b/include/nng/protocol/pubsub0/pub.h index 877f2f1c..3a23e43b 100644 --- a/include/nng/protocol/pubsub0/pub.h +++ b/include/nng/protocol/pubsub0/pub.h @@ -1,6 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,26 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PUBSUB0_PUB_H #define NNG_PROTOCOL_PUBSUB0_PUB_H - -#ifdef __cplusplus -extern "C" { #endif - -NNG_DECL int nng_pub0_open(nng_socket *); -NNG_DECL int nng_pub0_open_raw(nng_socket *); - -#ifndef nng_pub_open -#define nng_pub_open nng_pub0_open -#endif - -#ifndef nng_pub_open_raw -#define nng_pub_open_raw nng_pub0_open_raw -#endif - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PUBSUB0_PUB_H diff --git a/include/nng/protocol/pubsub0/sub.h b/include/nng/protocol/pubsub0/sub.h index a8a37823..5c03ca58 100644 --- a/include/nng/protocol/pubsub0/sub.h +++ b/include/nng/protocol/pubsub0/sub.h @@ -1,6 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,38 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_PUBSUB0_SUB_H #define NNG_PROTOCOL_PUBSUB0_SUB_H - -#include <nng/nng.h> - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_sub0_open(nng_socket *); - -NNG_DECL int nng_sub0_open_raw(nng_socket *); - -NNG_DECL int nng_sub0_socket_subscribe( - nng_socket id, const void *buf, size_t sz); -NNG_DECL int nng_sub0_socket_unsubscribe( - nng_socket id, const void *buf, size_t sz); -NNG_DECL int nng_sub0_ctx_subscribe(nng_ctx id, const void *buf, size_t sz); -NNG_DECL int nng_sub0_ctx_unsubscribe(nng_ctx id, const void *buf, size_t sz); - -#ifndef nng_sub_open -#define nng_sub_open nng_sub0_open #endif - -#ifndef nng_sub_open_raw -#define nng_sub_open_raw nng_sub0_open_raw -#endif - -#define NNG_OPT_SUB_PREFNEW "sub:prefnew" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_PUBSUB0_SUB_H diff --git a/include/nng/protocol/reqrep0/rep.h b/include/nng/protocol/reqrep0/rep.h index 04fe18bf..ec689067 100644 --- a/include/nng/protocol/reqrep0/rep.h +++ b/include/nng/protocol/reqrep0/rep.h @@ -1,6 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,31 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_REQREP0_REP_H #define NNG_PROTOCOL_REQREP0_REP_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_rep0_open(nng_socket *); -NNG_DECL int nng_rep0_open_raw(nng_socket *); - -#ifndef nng_rep_open -#define nng_rep_open nng_rep0_open -#endif - -#ifndef nng_rep_open_raw -#define nng_rep_open_raw nng_rep0_open_raw #endif - -#define NNG_REP0_SELF 0x31 -#define NNG_REP0_PEER 0x30 -#define NNG_REP0_SELF_NAME "rep" -#define NNG_REP0_PEER_NAME "req" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_REQREP0_REP_H diff --git a/include/nng/protocol/reqrep0/req.h b/include/nng/protocol/reqrep0/req.h index 0c9fde3f..987ae4c2 100644 --- a/include/nng/protocol/reqrep0/req.h +++ b/include/nng/protocol/reqrep0/req.h @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -8,33 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_REQREP0_REQ_H #define NNG_PROTOCOL_REQREP0_REQ_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_req0_open(nng_socket *); -NNG_DECL int nng_req0_open_raw(nng_socket *); - -#ifndef nng_req_open -#define nng_req_open nng_req0_open -#endif -#ifndef nng_req_open_raw -#define nng_req_open_raw nng_req0_open_raw #endif - -#define NNG_REQ0_SELF 0x30 -#define NNG_REQ0_PEER 0x31 -#define NNG_REQ0_SELF_NAME "req" -#define NNG_REQ0_PEER_NAME "rep" - -#define NNG_OPT_REQ_RESENDTIME "req:resend-time" -#define NNG_OPT_REQ_RESENDTICK "req:resend-tick" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_REQREP0_REQ_H diff --git a/include/nng/protocol/survey0/respond.h b/include/nng/protocol/survey0/respond.h index d7dab61d..57dc9704 100644 --- a/include/nng/protocol/survey0/respond.h +++ b/include/nng/protocol/survey0/respond.h @@ -1,6 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,31 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_SURVEY0_RESPOND_H #define NNG_PROTOCOL_SURVEY0_RESPOND_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_respondent0_open(nng_socket *); -NNG_DECL int nng_respondent0_open_raw(nng_socket *); - -#ifndef nng_respondent_open -#define nng_respondent_open nng_respondent0_open -#endif - -#ifndef nng_respondent_open_raw -#define nng_respondent_open_raw nng_respondent0_open_raw #endif - -#define NNG_RESPONDENT0_SELF 0x63 -#define NNG_RESPONDENT0_PEER 0x62 -#define NNG_RESPONDENT0_SELF_NAME "respondent" -#define NNG_RESPONDENT0_PEER_NAME "surveyor" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_SURVEY0_RESPOND_H diff --git a/include/nng/protocol/survey0/survey.h b/include/nng/protocol/survey0/survey.h index cea4d58b..33c271ea 100644 --- a/include/nng/protocol/survey0/survey.h +++ b/include/nng/protocol/survey0/survey.h @@ -1,6 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> -// Copyright 2018 Capitar IT Group BV <info@capitar.com> +// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech> // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -8,33 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // +// Content moved to nng/nng.h #ifndef NNG_PROTOCOL_SURVEY0_SURVEY_H #define NNG_PROTOCOL_SURVEY0_SURVEY_H - -#ifdef __cplusplus -extern "C" { -#endif - -NNG_DECL int nng_surveyor0_open(nng_socket *); -NNG_DECL int nng_surveyor0_open_raw(nng_socket *); - -#ifndef nng_surveyor_open -#define nng_surveyor_open nng_surveyor0_open -#endif - -#ifndef nng_surveyor_open_raw -#define nng_surveyor_open_raw nng_surveyor0_open_raw #endif - -#define NNG_SURVEYOR0_SELF 0x62 -#define NNG_SURVEYOR0_PEER 0x63 -#define NNG_SURVEYOR0_SELF_NAME "surveyor" -#define NNG_SURVEYOR0_PEER_NAME "respondent" - -#define NNG_OPT_SURVEYOR_SURVEYTIME "surveyor:survey-time" - -#ifdef __cplusplus -} -#endif - -#endif // NNG_PROTOCOL_SURVEY0_SURVEY_H |
