14#define SPRKL_REQUEST_MAGIC "PawRqust"
15#define SPRKL_REQUEST_MAGIC_SZ ((sizeof SPRKL_REQUEST_MAGIC) - 1)
17#define SPRKL_RESPONSE_MAGIC "PawRspns"
18#define SPRKL_RESPONSE_MAGIC_SZ ((sizeof SPRKL_RESPONSE_MAGIC) - 1)
20#define SPRKL_PROTO_VERSION 1
sprkl_sigalgo
Available signature algorithms.
Definition common.h:9
void sprkl_request_freeall(struct sprkl_request *request)
Frees any pointers contained within the request, and then the request itself.
Definition request.c:87
sprkl_request_verb
Request verb, indicates what action the request is performing.
Definition request.h:23
@ SPRKL_VERB_FETCHSERVICE
Fetch a service by key and index.
Definition request.h:25
@ SPRKL_VERB_ECHO
Return same data back in the response.
Definition request.h:24
char * sprkl_response_statusmsg(enum sprkl_response_status status)
Returns a default message for the given status code.
Definition request.c:115
sprkl_response_status
Response status code, indicates the outcome of a request.
Definition request.h:30
@ SPRKL_STATUS_NOT_IMPL
Operation not implemented.
Definition request.h:42
@ SPRKL_STATUS_REQ_ERR
Requester ("client") made an unspecified mistake.
Definition request.h:34
@ SPRKL_STATUS_VERB_UNK
Responder doesn't know how to deal with the request verb.
Definition request.h:47
@ SPRKL_STATUS_OK
Success.
Definition request.h:32
@ SPRKL_STATUS_RESP_ERR
Responder ("server") encountered an unspecified error.
Definition request.h:38
@ SPRKL_STATUS_NOT_FOUND
Requested resource was not found.
Definition request.h:36
@ SPRKL_STATUS_UNAVAIL
Responder is temporarily unable to process the request (for example due to maintenance or overload).
Definition request.h:45
int sprkl_response_write(struct sprkl_response *response, FILE *stream)
Encodes and writes a response in wire format to a stream.
Definition request.c:135
void sprkl_response_freeparts(struct sprkl_response *response, bool errmsg)
Frees any pointers contained within the response, but not the response itself.
Definition request.c:208
int sprkl_response_read(struct sprkl_response *response, FILE *stream)
Reads and decodes a response in wire format from a stream.
Definition request.c:169
int sprkl_request_read(struct sprkl_request *request, FILE *stream)
Reads and decodes a request in wire format from a stream.
Definition request.c:34
struct sprkl_request * sprkl_request_make_fetchservice(enum sprkl_sigalgo keyalgo, uint8_t *key, uint16_t serviceidx)
Allocates and returns a new request to fetch a service given its key and index.
Definition request.c:92
void sprkl_request_freeparts(struct sprkl_request *request)
Frees any pointers contained within the request, but not the request itself.
Definition request.c:76
void sprkl_response_freeall(struct sprkl_response *response)
Frees any pointers contained within the response, and then the response itself.
Definition request.c:221
int sprkl_request_write(struct sprkl_request *request, FILE *stream)
Encodes and writes a request in wire format to a stream.
Definition request.c:10
Services, records and tags.
Request payload for SPRKL_VERB_ECHO.
Definition request.h:51
uint8_t data[16]
Data to be returned by the responder.
Definition request.h:52
Request payload for SPRKL_VERB_FETCHSERVICE.
Definition request.h:61
uint16_t keysz
Length (in bytes) of the public key.
Definition request.h:63
uint8_t * key
The zone's public key (no terminator).
Definition request.h:64
enum sprkl_sigalgo keyalgo
The zone's signature algorithm.
Definition request.h:62
uint16_t index
Index of the service within the zone.
Definition request.h:65
Request tagged union.
Definition request.h:74
enum sprkl_request_verb verb
Union tag, request verb.
Definition request.h:75
Response payload for SPRKL_VERB_ECHO (same as request).
Definition request.h:56
uint8_t data[16]
Data given by the requester.
Definition request.h:57
Response payload for SPRKL_VERB_FETCHSERVICE.
Definition request.h:69
Response tagged union (varies on the associated request verb and status).
Definition request.h:84
enum sprkl_request_verb verb
Union tag, original request verb.
Definition request.h:85
uint8_t * errmsg
Error message (optional; UTF-8, no terminator).
Definition request.h:88
enum sprkl_response_status status
Also union tag, status code.
Definition request.h:86
uint16_t errmsgsz
Length of the error message (optional).
Definition request.h:87
A service, contains a collection of related records and is cryptographically signed.
Definition service.h:32