Services, records and tags.
More...
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
|
| int | sprkl_record_write (struct sprkl_record *record, FILE *stream) |
| | Encodes and writes a record in wire format to a stream.
|
| int | sprkl_record_read (struct sprkl_record *record, FILE *stream) |
| | Reads and decodes a record in wire format from a stream.
|
| void | sprkl_record_freepairs (struct sprkl_record *record, bool freevalues) |
| | Frees all the pairs in a record (but not the record itself).
|
| void | sprkl_record_freeall (struct sprkl_record *record) |
| | Frees all the pairs in a record, and then the record itself.
|
| int | sprkl_service_write (struct sprkl_service *service, FILE *stream) |
| | Encodes and writes a service in wire format to a stream.
|
| int | sprkl_service_read (struct sprkl_service *service, FILE *stream) |
| | Reads and decodes a service in wire format from a stream.
|
| int | sprkl_service_printdebug (struct sprkl_service *service, FILE *stream) |
| | Prints out a service for debugging purposes.
|
| void | sprkl_service_freeparts (struct sprkl_service *service, bool records, bool signature) |
| | Frees all the records and/or signature of a service (but not the service itself).
|
| void | sprkl_service_freeall (struct sprkl_service *service) |
| | Frees all the stuff in the service, and then the service itself.
|
Services, records and tags.
◆ sprkl_record_freeall()
Frees all the pairs in a record, and then the record itself.
Also frees all the values within the pairs.
- Parameters
-
◆ sprkl_record_freepairs()
| void sprkl_record_freepairs |
( |
struct sprkl_record * | record, |
|
|
bool | freevalues ) |
Frees all the pairs in a record (but not the record itself).
- Parameters
-
| record | Record whose pairs will be freed. |
| freevalues | If true, also free the value buffers within each pair. |
◆ sprkl_record_read()
| int sprkl_record_read |
( |
struct sprkl_record * | record, |
|
|
FILE * | stream ) |
Reads and decodes a record in wire format from a stream.
Allocates memory for the new pairs.
- Parameters
-
| [out] | record | Empty record to read into. |
| [in] | stream | Stream to read it from. |
- Returns
- number of bytes read.
◆ sprkl_record_write()
| int sprkl_record_write |
( |
struct sprkl_record * | record, |
|
|
FILE * | stream ) |
Encodes and writes a record in wire format to a stream.
- Parameters
-
| [in] | record | Record to write. |
| [out] | stream | Stream to write the record to. |
- Returns
- number of bytes written.
◆ sprkl_service_freeall()
Frees all the stuff in the service, and then the service itself.
Same as sprkl_service_freeparts() (with both options set to true), except it also calls free(service) at the end.
- Parameters
-
◆ sprkl_service_freeparts()
| void sprkl_service_freeparts |
( |
struct sprkl_service * | service, |
|
|
bool | records, |
|
|
bool | signature ) |
Frees all the records and/or signature of a service (but not the service itself).
When freeing the records it will also free all of their contents, including the pairs and the pairs' value buffers. Afterwards, the sprkl_service::reccnt and/or sprkl_service::sigsz fields will be zeroed as needed.
- Parameters
-
| service | Service to free. |
| records | Whether to free the records. |
| signature | Whether to free the buffer containing the signature. |
◆ sprkl_service_printdebug()
| int sprkl_service_printdebug |
( |
struct sprkl_service * | service, |
|
|
FILE * | stream ) |
Prints out a service for debugging purposes.
- Parameters
-
| [in] | service | Service to print out. |
| [out] | stream | Stream to print it to. |
- Returns
- number of bytes written.
◆ sprkl_service_read()
| int sprkl_service_read |
( |
struct sprkl_service * | service, |
|
|
FILE * | stream ) |
Reads and decodes a service in wire format from a stream.
Allocates memory for the new records and the signature.
- Parameters
-
| [out] | service | Empty service to read into. |
| [in] | stream | Stream to read it from. |
- Returns
- number of bytes read.
◆ sprkl_service_write()
| int sprkl_service_write |
( |
struct sprkl_service * | service, |
|
|
FILE * | stream ) |
Encodes and writes a service in wire format to a stream.
- Parameters
-
| [in] | service | Service to write. |
| [out] | stream | Stream to write the service to. |
- Returns
- number of bytes written.