|
Data Structures |
| struct | node_rxfc_mon |
| | This structure keeps tracks of remote flow-control indications and measures the time spent in flow-control over a period of time. More...
|
| struct | gnutella_node |
Defines |
| #define | NODE_RX_FC_HALF_PERIOD 300 |
| | 5 minutes
|
| #define | MAX_CACHE_HOPS 6 |
| | defines the maximum hop count we handle for the ping/pong caching scheme.
|
| #define | CACHE_HOP_IDX(h) (((h) > MAX_CACHE_HOPS) ? MAX_CACHE_HOPS : (h)) |
| | The macro returning the array index in the (0 ..
|
| #define | NODE_LEAF_MIN_FLOW 3 |
| | The value of the hops-flow under which the leaf is not fully searcheable, and which will NOT have its QRP included in the inter-UP QRP table.
|
| #define | PING_REG_THROTTLE 3 |
| | seconds, regular peer
|
| #define | PING_LEAF_THROTTLE 60 |
| | seconds, peer is leaf node
|
| #define | NODE_ID_SELF (node_id_get_self()) |
| #define | NODE_CR_CONNECTION 0x01 |
| | Include connection times.
|
| #define | NODE_CR_LOCALE 0x02 |
| | Include locale information.
|
| #define | NODE_CR_CRAWLABLE 0x04 |
| | Include crawlable peers only.
|
| #define | NODE_CR_USER_AGENT 0x08 |
| | Include user-agent strings.
|
| #define | NODE_CR_MASK 0x0f |
| | Mask for supported features.
|
| #define | NODE_CR_SEPARATOR ';' |
| #define | NODE_CR_ESCAPE_CHAR '\\' |
| #define | NODE_IS_CONNECTING(n) |
| #define | NODE_IS_CONNECTED(n) |
| #define | NODE_IS_INCOMING(n) ((n)->flags & NODE_F_INCOMING) |
| #define | NODE_IS_REMOVING(n) ((n)->status == GTA_NODE_REMOVING) |
| #define | NODE_IN_TX_FLOW_CONTROL(n) ((n)->outq && mq_is_flow_controlled((n)->outq)) |
| #define | NODE_IN_TX_SWIFT_CONTROL(n) ((n)->outq && mq_is_swift_controlled((n)->outq)) |
| #define | NODE_IS_WRITABLE(n) ((n)->flags & NODE_F_WRITABLE) |
| #define | NODE_IS_READABLE(n) (((n)->flags & (NODE_F_READABLE|NODE_F_NOREAD)) == NODE_F_READABLE) |
| #define | NODE_IS_ESTABLISHED(n) |
| #define | NODE_MQUEUE_PERCENT_USED(n) ((n)->outq ? mq_size((n)->outq) * 100 / mq_maxsize((n)->outq) : 0) |
| #define | NODE_SQUEUE(n) ((n)->searchq) |
| #define | NODE_MQUEUE_COUNT(n) ((n)->outq ? mq_count((n)->outq) : 0) |
| #define | NODE_MQUEUE_PENDING(n) ((n)->outq ? mq_pending((n)->outq) : 0) |
| #define | NODE_MQUEUE_ABOVE_LOWAT(n) ((n)->outq ? mq_size((n)->outq) > mq_lowat((n)->outq) : FALSE) |
| #define | NODE_SQUEUE_COUNT(n) ((n)->searchq ? sq_count((n)->searchq) : 0) |
| #define | NODE_SQUEUE_SENT(n) ((n)->searchq ? sq_sent((n)->searchq) : 0) |
| #define | NODE_RX_COMPRESSED(n) ((n)->attrs & NODE_A_RX_INFLATE) |
| #define | NODE_TX_COMPRESSED(n) ((n)->attrs & NODE_A_TX_DEFLATE) |
| #define | NODE_TX_COMPRESSION_RATIO(n) |
| #define | NODE_RX_COMPRESSION_RATIO(n) |
| #define | NODE_ID(n) ((n)->id) |
| #define | NODE_CAN_SFLAG(n) ((n)->attrs & NODE_A_CAN_SFLAG) |
| #define | NODE_UP_QRP(n) ((n)->attrs & NODE_A_UP_QRP) |
| #define | NODE_LEAF_GUIDE(n) ((n)->attrs & NODE_A_GUIDANCE) |
| #define | NODE_CAN_INFLATE(n) ((n)->attrs & NODE_A_CAN_INFLATE) |
| #define | NODE_IS_LEAF(n) ((n)->peermode == NODE_P_LEAF) |
| #define | NODE_IS_NORMAL(n) ((n)->peermode == NODE_P_NORMAL) |
| #define | NODE_IS_ULTRA(n) ((n)->peermode == NODE_P_ULTRA) |
| #define | NODE_IS_UDP(n) ((n)->peermode == NODE_P_UDP) |
| #define | node_vendor(n) ((n)->vendor != NULL ? (n)->vendor : "????") |
| #define | node_type(n) (NODE_IS_LEAF(n) ? "leaf" : NODE_IS_ULTRA(n) ? "ultra" : "legacy") |
| #define | node_inc_sent(n) node_add_sent(n, 1) |
| #define | node_inc_txdrop(n) node_add_txdrop(n, 1) |
| #define | node_inc_rxdrop(n) node_add_rxdrop(n, 1) |
| #define | node_add_tx_given(n, x) do { (n)->tx_given += (x); } while (0) |
| #define | node_add_rx_read(n, x) do { (n)->rx_read += (x); } while (0) |
| #define | node_inc_tx_query(n) do { (n)->tx_queries++; } while (0) |
| #define | node_inc_rx_query(n) do { (n)->rx_queries++; } while (0) |
| #define | node_inc_tx_qhit(n) do { (n)->tx_qhits++; } while (0) |
| #define | node_inc_rx_qhit(n) do { (n)->rx_qhits++; } while (0) |
| #define | node_inc_qrp_query(n) do { (n)->qrp_queries++; } while (0) |
| #define | node_inc_qrp_match(n) do { (n)->qrp_matches++; } while (0) |
| #define | node_ultra_received_qrp(n) |
| #define | node_leaf_sent_qrp(n) |
| #define | node_query_hops_ok(n, h) ((h) < (n)->hops_flow) |
| | Can we send query with hop count `h' according to node's hops-flow value?
|
| #define | node_flowc_swift_grace(n) (NODE_IS_LEAF(n) ? 210 : 30) |
| | The grace period between the time the node enters flow-control and the time we want to speed up things and drop traffic, entering "swift" mode.
|
| #define | node_flowc_swift_period(n) (NODE_IS_LEAF(n) ? 140 : 20) |
| | In "swift" mode, a callback is periodically invoked to drop more traffic if we don't see much progress in the queue backlog.
|
| #define | GNUTELLA_HELLO "GNUTELLA CONNECT/" |
| #define | GNUTELLA_HELLO_LENGTH (sizeof(GNUTELLA_HELLO) - 1) |
Typedefs |
| typedef gnutella_node | gnutella_node_t |
Enumerations |
| enum | node_magic_t { NODE_MAGIC = 0x67f8e02f
} |
| enum | {
NODE_F_HDSK_PING = 1 << 0,
NODE_F_STALE_QRP = 1 << 1,
NODE_F_INCOMING = 1 << 2,
NODE_F_ESTABLISHED = 1 << 3,
NODE_F_VALID = 1 << 4,
NODE_F_ALIEN_IP = 1 << 5,
NODE_F_WRITABLE = 1 << 6,
NODE_F_READABLE = 1 << 7,
NODE_F_BYE_SENT = 1 << 8,
NODE_F_NODELAY = 1 << 9,
NODE_F_NOREAD = 1 << 10,
NODE_F_EOF_WAIT = 1 << 11,
NODE_F_CLOSING = 1 << 12,
NODE_F_ULTRA = 1 << 13,
NODE_F_LEAF = 1 << 14,
NODE_F_CRAWLER = 1 << 15,
NODE_F_FAKE_NAME = 1 << 16,
NODE_F_PROXY = 1 << 17,
NODE_F_PROXIED = 1 << 18,
NODE_F_QRP_SENT = 1 << 19,
NODE_F_TSYNC_WAIT = 1 << 20,
NODE_F_TSYNC_TCP = 1 << 21,
NODE_F_GTKG = 1 << 22,
NODE_F_FORCE = 1 << 23,
NODE_F_NO_OOB_PROXY = 1 << 24,
NODE_F_TLS = 1 << 25,
NODE_F_CAN_TLS = 1 << 26
} |
| enum | {
NODE_A_BYE_PACKET = 1 << 0,
NODE_A_PONG_CACHING = 1 << 1,
NODE_A_PONG_ALIEN = 1 << 2,
NODE_A_QHD_NO_VTAG = 1 << 3,
NODE_A_RX_INFLATE = 1 << 4,
NODE_A_TX_DEFLATE = 1 << 5,
NODE_A_ULTRA = 1 << 6,
NODE_A_NO_ULTRA = 1 << 7,
NODE_A_UP_QRP = 1 << 8,
NODE_A_GUIDANCE = 1 << 9,
NODE_A_TIME_SYNC = 1 << 10,
NODE_A_CRAWLABLE = 1 << 11,
NODE_A_DYN_QUERY = 1 << 12,
NODE_A_CAN_SFLAG = 1 << 13,
NODE_A_NO_KEPT_ZERO = 1 << 14,
NODE_A_NO_DUPS = 1 << 15,
NODE_A_CAN_HSEP = 1 << 16,
NODE_A_CAN_QRP = 1 << 17,
NODE_A_CAN_VENDOR = 1 << 18,
NODE_A_CAN_ULTRA = 1 << 19,
NODE_A_CAN_INFLATE = 1 << 20,
NODE_A_CAN_HEAD = 1 << 21
} |
Functions |
| void | node_init (void) |
| | Network init.
|
| void | node_post_init (void) |
| | Post GUI initialization.
|
| void | node_slow_timer (time_t now) |
| | Low frequency node timer.
|
| void | node_timer (time_t now) |
| | Periodic node heartbeat timer.
|
| guint | connected_nodes (void) |
| guint | node_count (void) |
| guint | node_keep_missing (void) |
| | Amount of node connections we would like to keep.
|
| guint | node_missing (void) |
| | Amount of node connections we would like to have.
|
| guint | node_leaves_missing (void) |
| | Amount of leaves we're missing (0 if not in ultra mode).
|
| guint | node_outdegree (void) |
| gboolean | node_is_connected (const host_addr_t addr, guint16 port, gboolean incoming) |
| | Is there a node connected with this IP/port?
|
| gboolean | node_host_is_connected (const host_addr_t addr, guint16 port) |
| | Are we directly connected to that host?
|
| void | node_add_socket (struct gnutella_socket *s, const host_addr_t addr, guint16 port, guint32 flags) |
| | Add new node, to which we possibly have an existing connection if the socket is not NULL (incoming connection).
|
| void | node_remove (struct gnutella_node *, const gchar *reason,...) G_GNUC_PRINTF(2 |
| guint | node_remove_by_addr (const host_addr_t addr, guint16 port) |
| | Determine if the node with specified IP and port is connected.
|
| void | node_bye (gnutella_node_t *, gint code, const gchar *reason,...) G_GNUC_PRINTF(3 |
| void | node_real_remove (gnutella_node_t *) |
| | Physically dispose of node.
|
| void | node_eof (struct gnutella_node *n, const gchar *reason,...) G_GNUC_PRINTF(2 |
| void | node_shutdown (struct gnutella_node *n, const gchar *reason,...) G_GNUC_PRINTF(2 |
| void | node_bye_if_writable (struct gnutella_node *n, gint code, const gchar *reason,...) G_GNUC_PRINTF(3 |
| void | node_init_outgoing (struct gnutella_node *) |
| | Called when asynchronous connection to an outgoing node is established.
|
| void | node_sent_ttl0 (struct gnutella_node *n) |
| | Called when a node sends a message with TTL=0.
|
| void | node_disableq (struct gnutella_node *n) |
| void | node_enableq (struct gnutella_node *n) |
| void | node_flushq (struct gnutella_node *n) |
| | Called by queue when it's not empty and it went through the service routine and yet has more data enqueued.
|
| void | node_unflushq (struct gnutella_node *n) |
| | Called by queue to disable the flush mode.
|
| void | node_tx_service (struct gnutella_node *n, gboolean on) |
| | Called when the queue service routine is switched ON/OFF.
|
| void | node_tx_enter_flowc (struct gnutella_node *n) |
| | Called by message queue when the node enters TX flow control.
|
| void | node_tx_leave_flowc (struct gnutella_node *n) |
| | Called by message queue when the node leaves TX flow control.
|
| void | node_tx_enter_warnzone (struct gnutella_node *n) |
| | Called by message queue when the node enters the warn zone.
|
| void | node_tx_leave_warnzone (struct gnutella_node *n) |
| | Called by message queue when the node leaves the warn zone.
|
| void | node_tx_swift_changed (struct gnutella_node *n) |
| | Called by message queue when swift mode changes.
|
| void | node_bye_all (void) |
| | Send a BYE message to all the nodes.
|
| gboolean | node_bye_pending (void) |
| void | node_close (void) |
| | Final cleanup when application terminates.
|
| gboolean | node_remove_worst (gboolean non_local) |
| | Removes the node with the worst stats, considering the number of weird, bad and duplicate packets.
|
| void | node_qrt_changed (struct routing_table *query_table) |
| | Invoked for nodes when our Query Routing Table changed.
|
| void | node_qrt_discard (struct gnutella_node *n) |
| | Invoked when remote sends us a RESET message, making the existing routing table obsolete.
|
| void | node_qrt_install (struct gnutella_node *n, struct routing_table *) |
| | Invoked for ultra nodes to install new Query Routing Table.
|
| void | node_qrt_patched (struct gnutella_node *n, struct routing_table *) |
| | Invoked for ultra nodes when the Query Routing Table of remote node was fully patched (i.e.
|
| void | send_node_error (struct gnutella_socket *s, int code, const gchar *msg,...) G_GNUC_PRINTF(3 |
| void | node_add_sent (gnutella_node_t *n, gint x) |
| void | node_add_txdrop (gnutella_node_t *n, gint x) |
| void | node_add_rxdrop (gnutella_node_t *n, gint x) |
| void | node_set_vendor (gnutella_node_t *n, const gchar *vendor) |
| | Record vendor name (user-agent string).
|
| void | node_set_hops_flow (gnutella_node_t *n, guint8 hops) |
| | Called when a vendor-specific "hops-flow" message was received to tell us to update the hops-flow counter for the connection: no query whose hop count is greater or equal to the specified `hops' should be sent to that node.
|
| void | node_set_online_mode (gboolean on) |
| | Whether they want to be "online" within Gnutella or not.
|
| void | node_current_peermode_changed (node_peer_t mode) |
| | Called from the property system when current peermode is changed.
|
| const gchar * | node_addr (const gnutella_node_t *n) |
| const gchar * | node_addr2 (const gnutella_node_t *n) |
| const gchar * | node_gnet_addr (const gnutella_node_t *n) |
| void | node_connect_back (const gnutella_node_t *n, guint16 port) |
| | Connect back to node on specified port and emit a "\n\n" sequence.
|
| void | node_connected_back (struct gnutella_socket *s) |
| | Callback invoked from the socket layer when we are finally connected.
|
| void | node_mark_bad_vendor (struct gnutella_node *n) |
| | Gives a specific vendor a bad mark.
|
| void | node_proxying_remove (gnutella_node_t *n) |
| | Remove push proxy indication for the node, i.e.
|
| gboolean | node_proxying_add (gnutella_node_t *n, const gchar *guid) |
| | Record that node wants us to be his push proxy.
|
| void | node_proxy_add (gnutella_node_t *n, const host_addr_t addr, guint16 port) |
| | Add node to our list of push-proxies.
|
| void | node_proxy_cancel_all (void) |
| | Cancel all our known push-proxies.
|
| size_t | node_http_proxies_add (gchar *buf, size_t size, gpointer arg, guint32 flags) |
| | HTTP status callback.
|
| const GSList * | node_push_proxies (void) |
| const GSList * | node_all_nodes (void) |
| const GSList * | node_all_but_broken_gtkg (void) |
| gnutella_node_t * | node_by_id (const node_id_t node_id) |
| gnutella_node_t * | node_active_by_id (const node_id_t node_id) |
| void | node_set_leaf_guidance (const node_id_t node_id, gboolean supported) |
| | Set leaf-guidance support indication from give node ID.
|
| void | node_became_firewalled (void) |
| | Called when we were not firewalled and suddenly become firewalled.
|
| void | node_became_udp_firewalled (void) |
| | Called when we were not firewalled and suddenly become UDP firewalled.
|
| void | node_set_socket_rx_size (gint rx_size) |
| | Change the socket RX buffer size for all the currently connected nodes.
|
| mqueue_t * | node_udp_get_outq (enum net_type net) |
| | Get the message queue attached to the UDP node.
|
| void | node_udp_disable (void) |
| void | node_udp_process (struct gnutella_socket *s) |
| | Process incoming Gnutella datagram.
|
| gnutella_node_t * | node_udp_get_addr_port (const host_addr_t addr, guint16 port) |
| | Get "fake" node for UDP transmission.
|
| void | node_can_tsync (gnutella_node_t *n) |
| | Invoked when we determined that the node supports Time Sync.
|
| void | node_crawl (gnutella_node_t *n, gint ucnt, gint lcnt, guint8 features) |
| | Received an UDP crawler ping, requesting information about `ucnt' ultra nodes and `lcnt' leaves.
|
| void | node_update_udp_socket (void) |
| | This has to be called once the UDP socket (e.g., due to a changed port number) was changed because some internal references have to be updated.
|
| void | node_check_remote_ip_header (const host_addr_t peer, header_t *head) |
| | Checks for a Remote-IP or X-Remote-IP header and updates our IP address if the current IP address is not enforced.
|
| guint | feed_host_cache_from_headers (header_t *headers, host_type_t sender, gboolean gnet, const host_addr_t peer) |
| | Extract host:port information out of a header field and add those to our pong cache.
|
| gnutella_node_t * | node_browse_prepare (gnet_host_t *host, const gchar *vendor, gnutella_header_t *header, gchar *data, guint32 size) |
| | Let the "browse host" node hold the supplied Gnutella message as if coming from the host and from a servent with the supplied vendor string.
|
| void | node_browse_cleanup (gnutella_node_t *n) |
| | Cleanup the "browse host" node.
|
| void | node_kill_hostiles (void) |
| | Disconnects all connected nodes which are considered hostile.
|
| node_id_t | node_id_get_self (void) |
| gboolean | node_id_self (const node_id_t node_id) |
| void | node_check (const struct gnutella_node *const n) |
| const gchar * | node_guid (const struct gnutella_node *const n) |
| gboolean | node_set_guid (struct gnutella_node *n, const gchar *guid) |
| | Set the GUID of a connected node.
|
| gnutella_node * | node_by_guid (const gchar *guid) |
Variables |
| const gchar * | start_rfc822_date |
| | RFC822 format of start_time.
|
| GHookList | node_added_hook_list |
| gnutella_node * | node_added |
| | For use by node_added_hook_list hooks, since we can't add a parameter at list invoke time.
|