OpenVAS Scanner 23.40.3
user_agent.h File Reference

Header file: user agent functions prototypes. More...

#include "ipc.h"
#include <glib.h>
Include dependency graph for user_agent.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int user_agent_get (struct ipc_context *, char **)
 Get user-agent.
gchar * user_agent_set (const gchar *)
 Set user-agent.

Detailed Description

Header file: user agent functions prototypes.

Definition in file user_agent.h.

Function Documentation

◆ user_agent_get()

int user_agent_get ( struct ipc_context * ipc_context,
char ** useragent )

Get user-agent.

param[in] ipc_context IPC context for sending data to the parent process param[out] useragent the user agent if any set or an empty string.

Returns
0 on success, -1 on error when sending the message, -2 if the context does not exists

Definition at line 114 of file user_agent.c.

115{
116 int ret = 0;
117 if (!user_agent || user_agent[0] == '\0')
118 {
121 }
122
123 *useragent = user_agent ? g_strdup (user_agent) : "";
124 return ret;
125}
static int send_user_agent_via_ipc(struct ipc_context *ipc_context)
Definition user_agent.c:32
static void user_agent_create(void)
Create and set the global User-Agent variable.
Definition user_agent.c:57
static gchar * user_agent
user-agent, or NULL.
Definition user_agent.c:29

References send_user_agent_via_ipc(), user_agent, and user_agent_create().

Referenced by _http2_req(), and _http_req().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ user_agent_set()

gchar * user_agent_set ( const gchar * ua)

Set user-agent.

Set the global user agent. This function overwrite the existing UA. Null or empty string are not allowed.

Parameters
[in]uauser-agent to be set.

Return the old User-Agent. It must be free by the caller

Definition at line 89 of file user_agent.c.

90{
91 gchar *ua_aux = NULL;
92
93 ua_aux = g_strdup (user_agent);
94
95 if (ua != NULL && ua[0] != '\0')
96 {
97 g_free (user_agent);
98 user_agent = g_strdup (ua);
99 }
100
101 return ua_aux;
102}

References user_agent.

Referenced by process_ipc_data().

Here is the caller graph for this function: