sw_result
sw_text_record_init
(
sw_text_record * text_record)
text_record
: The text record object
int func(void)
{
sw_text_record text_record;
if (sw_text_record_init(&text_record) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return -1;
}
}
sw_text_record_fina
sw_result
sw_text_record_fina
(
sw_text_record text_record)
text_record
: The text record object.
int func(void)
{
sw_text_record text_record;
if (sw_text_record_init_(&text_record) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return -1;
}
//
// ... use text record
//
sw_text_record_fina(text_record);
sw_text_record_init
sw_result
sw_discovery_add_string
(
sw_text_record text_record,
sw_const_string string)
text_record
: The text record object.
string
: String to add to text record. UTF-8 encoded.
...
sw_text_record text_record;
if (sw_text_record_init(&text_record) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return -1;
}
if (sw_text_record_add_string(text_record, "Howl Rocks The House") != SW_OKAY)
{
fprintf(stderr, "add_string failed\n");
return -1;
}
...
sw_text_record_fina(text_record);
sw_text_record_add_key_and_string_value
, sw_text_record_add_key_and_binary_value
sw_result
sw_text_record_add_key_and_string_value
(
sw_text_record text_record,
sw_const_string key,
sw_const_string val)
text_record
: The text record object.
key
: A string denoting a lookup key for a value. UTF-8 encoded.
val
: A string denoting the value for this duple. UTF-8 encoded.
...
sw_text_record text_record;
if (sw_text_record_init(&text_record) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return -1;
}
if (sw_text_record_add_key_and_string_value(text_record, "Machine ID", "9782385") != SW_OKAY)
{
fprintf(stderr, "add_key_and_string_value failed\n");
return -1;
}
...
sw_text_record_fina(text_record);
sw_text_record_add_string
, sw_text_record_add_key_and_binary_value
sw_result
sw_text_record_add_key_and_binary_value
(
sw_text_record text_record,
sw_const_string key,
sw_octets val,
sw_ulong len)
text_record
: The text record object
key
: A string denoting a lookup key for a value. UTF-8 encoded.
val
: A string denoting the value for this duple.
len
: The length of the val described in octets.
...
sw_text_record text_record;
unsigned long data;
if (sw_text_record_init(&text_record) != SW_OKAY)
{
fprintf(stderr, "init failed\n");
return -1;
}
data = 42;
if (sw_text_record_add_key_and_binary_value(text_record, "Machine ID", (sw_octets) &data, sizeof(data)) != SW_OKAY)
{
fprintf(stderr, "add_key_and_string_value failed\n");
return -1;
}
...
sw_text_record_fina(text_record);
sw_text_record_add_string
, sw_text_record_add_key_and_string_value
sw_octets
sw_text_record_bytes
(
sw_text_record text_record)
text_record
: The text record object.
...
sw_octets bytes = sw_text_record_bytes(text_record);
...
sw_text_record_len
sw_ulong
sw_text_record_len
(
sw_text_record text_record)
text_record
: The text record object.
... sw_ulong = sw_text_record_len(text_record);SEE ALSO: