-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #857 from garlick/flux_msg_t
make flux_msg_t a bonafide type, add jansson payload accessors
- Loading branch information
Showing
46 changed files
with
1,367 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
flux_event_decode(3) | ||
==================== | ||
:doctype: manpage | ||
|
||
|
||
NAME | ||
---- | ||
flux_event_decode, flux_event_decodef, flux_event_encode, flux_event_encodef | ||
- encode/decode a Flux event message | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
#include <flux/core.h> | ||
|
||
int flux_event_decode (const flux_msg_t *msg, | ||
const char **topic, | ||
const char **json_str); | ||
|
||
int flux_event_decodef (const flux_msg_t *msg, | ||
const char **topic, | ||
const char *fmt, ...); | ||
|
||
flux_msg_t *flux_event_encode (const char *topic, | ||
const char *json_str); | ||
|
||
flux_msg_t *flux_event_encodef (const char *topic, | ||
const char *fmt, ...); | ||
|
||
|
||
DESCRIPTION | ||
----------- | ||
`flux_event_decode()` decodes a Flux event message _msg_. | ||
_topic_, if non-NULL, will be set the message's topic string. The storage | ||
for this string belongs to _msg_ and should not be freed. | ||
_json_str_, if non-NULL, will be set to the message's JSON payload. The | ||
storage for this string belongs to _msg_ and should not be freed. | ||
If non-NULL, decoding fails if the message doesn't have a JSON payload. | ||
If NULL, decoding fails if the message does have a JSON payload. | ||
`flux_event_decodef()` decodes a Flux event message with a JSON payload as | ||
above, parsing the payload using variable arguments with a format string | ||
in the style of jansson's `json_unpack()` (used internally). Decoding fails | ||
if the message doesn't have a JSON payload. | ||
`flux_event_encode()` encodes a Flux event message with topic string _topic_ | ||
and optional JSON payload _json_str_. The newly constructed message that | ||
is returned must be destroyed with `flux_msg_destroy()`. | ||
`flux_event_decodef()` decodes a Flux event message with a JSON payload as | ||
above, parsing the payload using variable arguments with a format string | ||
in the style of jansson's `json_unpack()` (used internally). Decoding fails | ||
if the message doesn't have a JSON payload. | ||
Events propagated to all subscribers. Events will not be received | ||
without a matching subscription established using `flux_event_subscribe()`. | ||
RETURN VALUE | ||
------------ | ||
|
||
Decoding functions return 0 on success. On error, -1 is returned, and | ||
errno is set appropriately. | ||
|
||
Encoding functions return a message on success. On error, NULL is returned, | ||
and errno is set appropriately. | ||
|
||
|
||
ERRORS | ||
------ | ||
EINVAL:: | ||
The _msg_ argument was NULL or there was a problem encoding. | ||
ENOMEM:: | ||
Memory was unavailable. | ||
EPROTO:: | ||
Message decoding failed, such as due to missing or unexpected payload, | ||
incorrect message type, missing topic string, etc.. | ||
AUTHOR | ||
------ | ||
This page is maintained by the Flux community. | ||
|
||
|
||
RESOURCES | ||
--------- | ||
Github: <http://github.com/flux-framework> | ||
COPYRIGHT | ||
--------- | ||
include::COPYRIGHT.adoc[] | ||
|
||
|
||
SEE ALSO | ||
--------- | ||
flux_event_subscribe(3) | ||
http://jansson.readthedocs.io/en/2.7/apiref.html#parsing-and-validating-values[Jansson API: Parsing and Validating Values] | ||
http://jansson.readthedocs.io/en/2.7/apiref.html#building-values[Jansson API: Building Values] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
flux_request_decode(3) | ||
====================== | ||
:doctype: manpage | ||
|
||
|
||
NAME | ||
---- | ||
flux_request_decode, flux_request_decodef, flux_request_decode_raw - decode a Flux request message | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
#include <flux/core.h> | ||
|
||
int flux_request_decode (const flux_msg_t *msg, | ||
const char **topic, | ||
const char **json_str); | ||
|
||
int flux_request_decodef (const flux_msg_t *msg, | ||
const char **topic, | ||
const char *fmt, ...); | ||
|
||
int flux_request_decode_raw (const flux_msg_t *msg, | ||
const char **topic, | ||
void *data, int *len); | ||
|
||
DESCRIPTION | ||
----------- | ||
`flux_request_decode()` decodes a request message _msg_. | ||
_topic_, if non-NULL, will be set the message's topic string. The storage | ||
for this string belongs to _msg_ and should not be freed. | ||
_json_str_, if non-NULL, will be set to the message's JSON payload. The | ||
storage for this string belongs to _msg_ and should not be freed. | ||
If non-NULL, decoding fails if the message doesn't have a JSON payload. | ||
If NULL, decoding fails if the message does have a JSON payload. | ||
`flux_request_decodef()` decodes a request message with a JSON payload as | ||
above, parsing the payload using variable arguments with a format string | ||
in the style of jansson's `json_unpack()` (used internally). Decoding fails | ||
if the message doesn't have a JSON payload. | ||
`flux_request_decode_raw()` decodes a request message with a raw payload, | ||
setting _data_ and _len_ to the payload data and length. The storage for | ||
the raw payload belongs to _msg_ and should not be freed. | ||
RETURN VALUE | ||
------------ | ||
|
||
These functions return 0 on success. On error, -1 is returned, and | ||
errno is set appropriately. | ||
|
||
|
||
ERRORS | ||
------ | ||
EINVAL:: | ||
The _msg_ argument was NULL. | ||
EPROTO:: | ||
Message decoding failed, such as due to missing or unexpected payload, | ||
incorrect message type, missing topic string, etc.. | ||
AUTHOR | ||
------ | ||
This page is maintained by the Flux community. | ||
|
||
|
||
RESOURCES | ||
--------- | ||
Github: <http://github.com/flux-framework> | ||
COPYRIGHT | ||
--------- | ||
include::COPYRIGHT.adoc[] | ||
|
||
|
||
SEE ALSO | ||
--------- | ||
flux_respond(3), flux_rpc(3) | ||
http://jansson.readthedocs.io/en/2.7/apiref.html#parsing-and-validating-values[Jansson API: Parsing and Validating Values] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,3 +334,7 @@ getf | |
jansson | ||
jansson's | ||
rpcf | ||
decodef | ||
len | ||
respondf | ||
encodef |
Oops, something went wrong.