#include "common.h"
#include "pproxy.h"
#include "http.h"
#include "hosts.h"
#include "version.h"
#include "sockets.h"
#include "ioheader.h"
#include "bsched.h"
#include "routing.h"
#include "gmsg.h"
#include "uploads.h"
#include "ggep.h"
#include "ggep_type.h"
#include "gnet_stats.h"
#include "lib/url.h"
#include "settings.h"
#include "token.h"
#include "downloads.h"
#include "lib/misc.h"
#include "lib/atoms.h"
#include "lib/getline.h"
#include "lib/header.h"
#include "lib/glib-missing.h"
#include "lib/endian.h"
#include "lib/tm.h"
#include "lib/walloc.h"
#include "if/gnet_property_priv.h"
#include "lib/override.h"
Defines | |
#define | PPROXY(x) ((struct pproxy *) (x)) |
#define | CPROXY_MAGIC 0xc8301U |
Functions | |
RCSID ("$Id:pproxy.c, v 1.27 2005/10/21 17:39:06 cbiere Exp $") | |
void | send_pproxy_error (struct pproxy *pp, int code, const gchar *msg,...) G_GNUC_PRINTF(3 |
Send error message to requestor. | |
void | pproxy_error_remove (struct pproxy *pp, int code, const gchar *msg,...) G_GNUC_PRINTF(3 |
Utility routine. | |
void | pproxy_free_resources (struct pproxy *pp) |
Get rid of all the resources attached to the push-proxy struct. | |
void | send_pproxy_error_v (struct pproxy *pp, const gchar *ext, int code, const gchar *msg, va_list ap) |
The vectorized (message-wise) version of send_pproxy_error(). | |
void | pproxy_remove_v (struct pproxy *pp, const gchar *reason, va_list ap) |
The vectorized (message-wise) version of pproxy_remove(). | |
void | pproxy_remove (struct pproxy *pp, const gchar *reason,...) |
Remove push proxy entry, log reason. | |
void | pproxy_timer (time_t now) |
Push proxy timer. | |
pproxy * | pproxy_create (struct gnutella_socket *s) |
pproxy_create | |
gboolean | get_params (struct pproxy *pp, gchar *request, gchar **guid_atom, guint32 *file_idx) |
Extract GUID for push-proxyfication from the HTTP request line. | |
const gchar * | build_push (size_t *size_ptr, guint8 ttl, guint8 hops, const gchar *guid, host_addr_t addr, guint16 port, guint32 file_idx) |
Builds a push request to send. | |
gchar * | validate_vendor (gchar *vendor, gchar *token, const host_addr_t addr) |
Validate vendor. | |
void | pproxy_request (struct pproxy *pp, header_t *header) |
Called once all the HTTP headers have been read to proceed with the push proxyfication. | |
void | err_line_too_long (gpointer obj) |
void | err_header_error_tell (gpointer obj, gint error) |
void | err_header_error (gpointer obj, gint error) |
void | err_input_exception (gpointer obj) |
void | err_input_buffer_full (gpointer obj) |
void | err_header_read_error (gpointer obj, gint error) |
void | err_header_read_eof (gpointer obj) |
void | err_header_extra_data (gpointer obj) |
void | call_pproxy_request (gpointer obj, header_t *header) |
void | pproxy_add (struct gnutella_socket *s) |
Create new push-proxy request and begin reading HTTP headers. | |
void | pproxy_close (void) |
Called a shutdown time. | |
gboolean | cproxy_http_header_ind (gpointer handle, header_t *header, gint code, const gchar *message) |
HTTP async callback for header reception notification. | |
size_t | cproxy_build_request (gpointer handle, gchar *buf, size_t len, const gchar *verb, const gchar *path, const gchar *host, guint16 port) |
Redefines the HTTP request building. | |
void | cproxy_http_newstate (gpointer handle, http_state_t newstate) |
Invoked when the state of the HTTP async request changes. | |
void | cproxy_free (struct cproxy *cp) |
Free the structure and all its dependencies. | |
void | cproxy_http_error_ind (gpointer handle, http_errtype_t type, gpointer v) |
HTTP async callback for error notifications. | |
cproxy * | cproxy_create (struct download *d, const host_addr_t addr, guint16 port, gchar *guid, guint32 file_idx) |
Create client proxy. | |
void | cproxy_reparent (struct download *d, struct download *cd) |
Updates the proxy structures to point to the right download when a download was cloned. | |
Variables | |
GSList * | pproxies = NULL |
Currently active push-proxy requests. | |
const struct io_error | pproxy_io_error |
|
|
|
|
|
Builds a push request to send. We set TTL=max_ttl-1 and hops=1 since it does not come from our node really. The file ID may be set to 0, but it should be ignored when the GIV is received anyway.
|
|
|
|
Redefines the HTTP request building. See http_async_build_request() for the model and details about the various parameters.
|
|
Create client proxy.
|
|
Free the structure and all its dependencies.
|
|
HTTP async callback for error notifications.
|
|
HTTP async callback for header reception notification.
|
|
Invoked when the state of the HTTP async request changes.
|
|
Updates the proxy structures to point to the right download when a download was cloned.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Extract GUID for push-proxyfication from the HTTP request line. Extract file index if present (otherwise 0 will be used). Fills the GUID atom into `guid_atom' and the file index into `file_idx'.
|
|
Create new push-proxy request and begin reading HTTP headers.
|
|
Called a shutdown time.
|
|
pproxy_create
|
|
Utility routine. Cancel the request, sending back the HTTP error message. |
|
Get rid of all the resources attached to the push-proxy struct. But not the structure itself. |
|
Remove push proxy entry, log reason. If no status has been sent back on the HTTP stream yet, give them a 400 error with the reason. |
|
The vectorized (message-wise) version of pproxy_remove().
|
|
Called once all the HTTP headers have been read to proceed with the push proxyfication.
|
|
Push proxy timer.
|
|
|
|
Send error message to requestor. This can only be done once per connection. |
|
The vectorized (message-wise) version of send_pproxy_error().
|
|
Validate vendor.
|
|
Currently active push-proxy requests.
|
|
Initial value: { err_line_too_long, err_header_error_tell, err_header_error, err_input_exception, err_input_buffer_full, err_header_read_error, err_header_read_eof, err_header_extra_data, } |