|
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 */ |
| 5 minutes
|
#define | MAX_CACHE_HOPS 6 /* We won't handle anything larger */ |
| 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 | PING_REG_THROTTLE 3 /**< seconds, regular peer */ |
| seconds, regular peer
|
#define | PING_LEAF_THROTTLE 60 /**< seconds, peer is leaf node */ |
| seconds, peer is leaf node
|
#define | NODE_F_HDSK_PING 0x00000001 /**< Expecting handshake ping */ |
| Expecting handshake ping.
|
#define | NODE_F_STALE_QRP 0x00000002 /**< Is sending a stale QRP patch */ |
| Is sending a stale QRP patch.
|
#define | NODE_F_INCOMING 0x00000004 /**< Incoming (permanent) connection */ |
| Incoming (permanent) connection.
|
#define | NODE_F_ESTABLISHED 0x00000008 /**< Gnutella connection established */ |
| Gnutella connection established.
|
#define | NODE_F_VALID 0x00000010 /**< Handshaked with a Gnutella node */ |
| Handshaked with a Gnutella node.
|
#define | NODE_F_ALIEN_IP 0x00000020 /**< Pong-IP did not match TCP/IP addr */ |
| Pong-IP did not match TCP/IP addr.
|
#define | NODE_F_WRITABLE 0x00000040 /**< Node is writable */ |
| Node is writable.
|
#define | NODE_F_READABLE 0x00000080 /**< Node is readable, process queries */ |
| Node is readable, process queries.
|
#define | NODE_F_BYE_SENT 0x00000100 /**< Bye message was queued */ |
| Bye message was queued.
|
#define | NODE_F_NODELAY 0x00000200 /**< TCP_NODELAY was activated */ |
| TCP_NODELAY was activated.
|
#define | NODE_F_NOREAD 0x00000400 /**< Prevent further reading from node */ |
| Prevent further reading from node.
|
#define | NODE_F_EOF_WAIT 0x00000800 /**< At final shutdown, waiting EOF */ |
| At final shutdown, waiting EOF.
|
#define | NODE_F_CLOSING 0x00001000 /**< Initiated bye or shutdown */ |
| Initiated bye or shutdown.
|
#define | NODE_F_ULTRA 0x00002000 /**< Is one of our ultra nodes */ |
| Is one of our ultra nodes.
|
#define | NODE_F_LEAF 0x00004000 /**< Is one of our leaves */ |
| Is one of our leaves.
|
#define | NODE_F_CRAWLER 0x00008000 /**< Is a Gnutella Crawler */ |
| Is a Gnutella Crawler.
|
#define | NODE_F_FAKE_NAME 0x00010000 /**< Was unable to validate GTKG name */ |
| Was unable to validate GTKG name.
|
#define | NODE_F_PROXY 0x00020000 /**< Sent a push-proxy request to it */ |
| Sent a push-proxy request to it.
|
#define | NODE_F_PROXIED 0x00040000 /**< We are push-proxy for that node */ |
| We are push-proxy for that node.
|
#define | NODE_F_QRP_SENT 0x00080000 /**< Undergone 1 complete QRP sending */ |
| Undergone 1 complete QRP sending.
|
#define | NODE_F_TLS 0x00100000 /**< TLS-tunneled */ |
| TLS-tunneled.
|
#define | NODE_F_TSYNC_WAIT 0x00200000 /**< Time sync pending via TCP */ |
| Time sync pending via TCP.
|
#define | NODE_F_TSYNC_TCP 0x00400000 /**< No replies via UDP, use TCP */ |
| No replies via UDP, use TCP.
|
#define | NODE_F_GTKG 0x00800000 /**< Node is another gtk-gnutella */ |
| Node is another gtk-gnutella.
|
#define | NODE_F_FORCE 0x01000000 /**< Connection is forced */ |
| Connection is forced.
|
#define | NODE_A_BYE_PACKET 0x00000001 /**< Supports Bye-Packet */ |
| Supports Bye-Packet.
|
#define | NODE_A_PONG_CACHING 0x00000002 /**< Supports Pong-Caching */ |
| Supports Pong-Caching.
|
#define | NODE_A_PONG_ALIEN 0x00000004 /**< Alien Pong-Caching scheme */ |
| Alien Pong-Caching scheme.
|
#define | NODE_A_QHD_NO_VTAG 0x00000008 /**< Servent has no vendor tag in QHD */ |
| Servent has no vendor tag in QHD.
|
#define | NODE_A_RX_INFLATE 0x00000010 /**< Reading compressed data */ |
| Reading compressed data.
|
#define | NODE_A_TX_DEFLATE 0x00000020 /**< Sending compressed data */ |
| Sending compressed data.
|
#define | NODE_A_ULTRA 0x00000040 /**< Node wants to be an Ultrapeer */ |
| Node wants to be an Ultrapeer.
|
#define | NODE_A_NO_ULTRA 0x00000080 /**< Node is NOT ultra capable */ |
| Node is NOT ultra capable.
|
#define | NODE_A_UP_QRP 0x00000100 /**< Supports intra-UP QRP */ |
| Supports intra-UP QRP.
|
#define | NODE_A_LEAF_GUIDE 0x00000200 /**< Supports leaf-guided dyn queries */ |
| Supports leaf-guided dyn queries.
|
#define | NODE_A_TIME_SYNC 0x00000400 /**< Supports time sync */ |
| Supports time sync.
|
#define | NODE_A_CRAWLABLE 0x00000800 /**< Node can be UDP-crawled */ |
| Node can be UDP-crawled.
|
#define | NODE_A_DYN_QUERY 0x00001000 /**< Node can perform dynamic queries */ |
| Node can perform dynamic queries.
|
#define | NODE_A_NO_DUPS 0x02000000 /**< For broken old GTKG: no dups! */ |
| For broken old GTKG: no dups!
|
#define | NODE_A_CAN_HSEP 0x04000000 /**< Node supports HSEP */ |
| Node supports HSEP.
|
#define | NODE_A_CAN_QRP 0x08000000 /**< Node supports query routing */ |
| Node supports query routing.
|
#define | NODE_A_CAN_VENDOR 0x10000000 /**< Node supports vendor messages */ |
| Node supports vendor messages.
|
#define | NODE_A_CAN_GGEP 0x20000000 /**< Node supports big pongs, etc.. */ |
| Node supports big pongs, etc.
|
#define | NODE_A_CAN_ULTRA 0x40000000 /**< Node is ultra capable */ |
| Node is ultra capable.
|
#define | NODE_A_CAN_INFLATE 0x80000000 /**< Node capable of inflating */ |
| Node capable of inflating.
|
#define | NODE_CR_CONNECTION 0x01 /**< Include connection times */ |
| Include connection times.
|
#define | NODE_CR_LOCALE 0x02 /**< Include locale information */ |
| Include locale information.
|
#define | NODE_CR_CRAWLABLE 0x04 /**< Include crawlable peers only */ |
| Include crawlable peers only.
|
#define | NODE_CR_USER_AGENT 0x08 /**< Include user-agent strings */ |
| Include user-agent strings.
|
#define | NODE_CR_MASK 0x0f /**< Mask for supported features */ |
| 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_GGEP(n) ((n)->attrs & NODE_A_CAN_GGEP) |
#define | NODE_UP_QRP(n) ((n)->attrs & NODE_A_UP_QRP) |
#define | NODE_GUIDES_QUERY(n) ((n)->attrs & NODE_A_LEAF_GUIDE) |
#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) |
#define | NODE_ID_LOCAL 0x0U /**< ID for "local node" (ourselves) */ |
| ID for "local node" (ourselves).
|
Typedefs |
typedef enum node_protocol_types | node_protocol_types_t |
typedef gnutella_node | gnutella_node_t |
Enumerations |
enum | node_protocol_types { PROTOCOL_TYPE_GNUTELLA = 0,
PROTOCOL_TYPE_G2
} |
enum | node_magic_t { NODE_MAGIC = 0x67f8e02f
} |
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 |
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 (gpointer 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, gpointer query_table) |
| Invoked for ultra nodes to install new Query Routing Table.
|
void | node_qrt_patched (struct gnutella_node *n, gpointer query_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_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, gboolean discard) |
| Remove push proxy indication for the node, i.e.
|
gboolean | node_proxying_add (gnutella_node_t *n, 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.
|
void | node_http_proxies_add (gchar *buf, gint *retval, gpointer arg, guint32 flags) |
| HTTP status callback.
|
GSList * | node_push_proxies (void) |
const GSList * | node_all_nodes (void) |
const GSList * | node_all_but_broken_gtkg (void) |
gnutella_node_t * | node_active_by_id (guint32 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 (void) |
| Get the message queue attached to the UDP node.
|
void | node_udp_enable (void) |
| Enable UDP transmission via pseudo node.
|
void | node_udp_disable (void) |
| Disable UDP transmission via pseudo node.
|
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, struct gnutella_header *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.
|
Variables |
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.
|