OpenVAS Scanner  22.7.9
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

const gchar * user_agent_get (struct ipc_context *)
 Get user-agent. More...
 
gchar * user_agent_set (const gchar *)
 Set user-agent. More...
 

Detailed Description

Header file: user agent functions prototypes.

Definition in file user_agent.h.

Function Documentation

◆ user_agent_get()

const gchar* user_agent_get ( struct ipc_context ipc_context)

Get user-agent.

Returns
Get user-agent.

Definition at line 106 of file user_agent.c.

107 {
108  if (!user_agent || user_agent[0] == '\0')
109  {
112  }
113 
114  return user_agent ? user_agent : "";
115 }

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

Referenced by _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 85 of file user_agent.c.

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

References user_agent.

Referenced by process_ipc_data().

Here is the caller graph for this function:
send_user_agent_via_ipc
static void send_user_agent_via_ipc(struct ipc_context *ipc_context)
Definition: user_agent.c:32
user_agent_create
static void user_agent_create()
Create and set the global User-Agent variable.
Definition: user_agent.c:53
ipc_context
Definition: ipc.h:32
user_agent
static gchar * user_agent
user-agent, or NULL.
Definition: user_agent.c:29