Skip to content

Commit

Permalink
Add: function read_text_string_c
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Aug 22, 2023
1 parent 36827e9 commit 9b4c549
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions util/xmlutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,30 @@ read_text_c (gvm_connection_t *connection, char **text)
return 0;
}

/**
* @brief Read text from the server.
*
* @param[in] connection Connection.
* @param[out] string Destination for output.
*
* @return 0 success, -1 read error, -2 argument error.
*/
int
read_text_string_c (gvm_connection_t *connection, GString **string)
{
int ret;

if ((string == NULL) || (*string == NULL))
return -2;

if (connection->tls)
ret = try_read_string (&connection->session, 0, string);
else
ret = try_read_string_s (connection->socket, 0, string);

return ret;
}

/**
* @brief Read entity and text. Free the entity immediately.
*
Expand Down
3 changes: 3 additions & 0 deletions util/xmlutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ read_string_c (gvm_connection_t *, GString **);
int
read_text_c (gvm_connection_t *, char **);

int
read_text_string_c (gvm_connection_t *, GString **);

int
parse_entity (const char *, entity_t *);

Expand Down

0 comments on commit 9b4c549

Please sign in to comment.