Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: function read_text_string_c #787

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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