n2n_typedefs.h (n2n-3.0) | : | n2n_typedefs.h (n2n-3.1.1) | ||
---|---|---|---|---|
/** | /** | |||
* (C) 2007-21 - ntop.org and contributors | * (C) 2007-22 - ntop.org and contributors | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 3 of the License, or | * the Free Software Foundation; either version 3 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
skipping to change at line 278 | skipping to change at line 278 | |||
#define N2N_EUNKNOWN -1 | #define N2N_EUNKNOWN -1 | |||
#define N2N_ENOTIMPL -2 | #define N2N_ENOTIMPL -2 | |||
#define N2N_EINVAL -3 | #define N2N_EINVAL -3 | |||
#define N2N_ENOSPACE -4 | #define N2N_ENOSPACE -4 | |||
#define N2N_VERSION_STRING_SIZE 20 | #define N2N_VERSION_STRING_SIZE 20 | |||
typedef char n2n_version_t[N2N_VERSION_STRING_SIZE]; | typedef char n2n_version_t[N2N_VERSION_STRING_SIZE]; | |||
#define SN_SELECTION_STRATEGY_LOAD 1 | #define SN_SELECTION_STRATEGY_LOAD 1 | |||
#define SN_SELECTION_STRATEGY_RTT 2 | #define SN_SELECTION_STRATEGY_RTT 2 | |||
#define SN_SELECTION_STRATEGY_MAC 3 /* REVISIT: not implemented yet */ | #define SN_SELECTION_STRATEGY_MAC 3 | |||
typedef struct n2n_ip_subnet { | typedef struct n2n_ip_subnet { | |||
uint32_t net_addr; /* Host order IP address. */ | uint32_t net_addr; /* Host order IP address. */ | |||
uint8_t net_bitlen; /* Subnet prefix. */ | uint8_t net_bitlen; /* Subnet prefix. */ | |||
} n2n_ip_subnet_t; | } n2n_ip_subnet_t; | |||
typedef struct n2n_sock { | typedef struct n2n_sock { | |||
uint8_t family; /* AF_INET or AF_INET6; or 0 if invalid * / | uint8_t family; /* AF_INET or AF_INET6; or 0 if invalid * / | |||
uint16_t port; /* host order */ | uint16_t port; /* host order */ | |||
union { | union { | |||
skipping to change at line 614 | skipping to change at line 614 | |||
pthread_mutex_t access; /* mutex for shared access */ | pthread_mutex_t access; /* mutex for shared access */ | |||
#endif | #endif | |||
uint8_t request; /* flags main thread's need for inter mediate resolution */ | uint8_t request; /* flags main thread's need for inter mediate resolution */ | |||
time_t check_interval;/* interval to checik resolover resul ts */ | time_t check_interval;/* interval to checik resolover resul ts */ | |||
time_t last_checked; /* last time the resolver results wer e cheked */ | time_t last_checked; /* last time the resolver results wer e cheked */ | |||
time_t last_resolved; /* last time the resolver completed * / | time_t last_resolved; /* last time the resolver completed * / | |||
} n2n_resolve_parameter_t; | } n2n_resolve_parameter_t; | |||
/* *************************************************** */ | /* *************************************************** */ | |||
// structure to hold port mapping thread's parameters | ||||
typedef struct n2n_port_map_parameter { | ||||
#ifdef HAVE_PTHREAD | ||||
pthread_t id; /* thread id */ | ||||
pthread_mutex_t access; /* mutex for shared access */ | ||||
#endif | ||||
uint16_t mgmt_port; | ||||
uint16_t mapped_port; | ||||
uint16_t new_port; /* REVISIT: remove with management po | ||||
rt subscriptions */ | ||||
} n2n_port_map_parameter_t; | ||||
/* *************************************************** */ | ||||
typedef struct n2n_edge_conf { | typedef struct n2n_edge_conf { | |||
struct peer_info *supernodes; /**< List of supernodes */ | struct peer_info *supernodes; /**< List of supernodes */ | |||
n2n_route_t *routes; /**< Networks to route thro ugh n2n */ | n2n_route_t *routes; /**< Networks to route thro ugh n2n */ | |||
n2n_community_t community_name; /**< The community. 16 full octets. */ | n2n_community_t community_name; /**< The community. 16 full octets. */ | |||
n2n_desc_t dev_desc; /**< The device description (hint) */ | n2n_desc_t dev_desc; /**< The device description (hint) */ | |||
n2n_private_public_key_t *public_key; /**< edge's public key (for user/password based authentication) */ | n2n_private_public_key_t *public_key; /**< edge's public key (for user/password based authentication) */ | |||
n2n_private_public_key_t *shared_secret; /**< shared secret derived from federation public key, username and password */ | n2n_private_public_key_t *shared_secret; /**< shared secret derived from federation public key, username and password */ | |||
he_context_t *shared_secret_ctx; /**< context holding the ro undkeys derived from shared secret */ | he_context_t *shared_secret_ctx; /**< context holding the ro undkeys derived from shared secret */ | |||
n2n_private_public_key_t *federation_public_key; /**< federation public key provided by command line */ | n2n_private_public_key_t *federation_public_key; /**< federation public key provided by command line */ | |||
uint8_t header_encryption; /**< Header encryption indi cator. */ | uint8_t header_encryption; /**< Header encryption indi cator. */ | |||
skipping to change at line 653 | skipping to change at line 666 | |||
uint8_t preferred_sock_auto; /**< indicates desired auto detect for preferred sock */ | uint8_t preferred_sock_auto; /**< indicates desired auto detect for preferred sock */ | |||
int local_port; | int local_port; | |||
int mgmt_port; | int mgmt_port; | |||
uint8_t connect_tcp; /** connection to supernode 0 = UDP; 1 = TCP */ | uint8_t connect_tcp; /** connection to supernode 0 = UDP; 1 = TCP */ | |||
n2n_auth_t auth; | n2n_auth_t auth; | |||
filter_rule_t *network_traffic_filter_rules; | filter_rule_t *network_traffic_filter_rules; | |||
int metric; /**< Network interface metri c (Windows only). */ | int metric; /**< Network interface metri c (Windows only). */ | |||
uint8_t sn_selection_strategy; /**< encodes currently chose n supernode selection strategy. */ | uint8_t sn_selection_strategy; /**< encodes currently chose n supernode selection strategy. */ | |||
uint8_t number_max_sn_pings; /**< Number of maximum concu rrently allowed supernode pings. */ | uint8_t number_max_sn_pings; /**< Number of maximum concu rrently allowed supernode pings. */ | |||
uint64_t mgmt_password_hash; /**< contains hash of managa ment port password. */ | uint64_t mgmt_password_hash; /**< contains hash of managa ment port password. */ | |||
uint8_t port_forwarding; /**< indicates if port forwa rding UPNP/PMP is enabled */ | ||||
} n2n_edge_conf_t; | } n2n_edge_conf_t; | |||
struct n2n_edge_stats { | struct n2n_edge_stats { | |||
uint32_t tx_p2p; | uint32_t tx_p2p; | |||
uint32_t rx_p2p; | uint32_t rx_p2p; | |||
uint32_t tx_sup; | uint32_t tx_sup; | |||
uint32_t rx_sup; | uint32_t rx_sup; | |||
uint32_t tx_sup_broadcast; | uint32_t tx_sup_broadcast; | |||
uint32_t rx_sup_broadcast; | uint32_t rx_sup_broadcast; | |||
}; | }; | |||
skipping to change at line 675 | skipping to change at line 689 | |||
n2n_edge_conf_t conf; | n2n_edge_conf_t conf; | |||
/* Status */ | /* Status */ | |||
int *keep_running; /**< Po inter to edge loop stop/go flag */ | int *keep_running; /**< Po inter to edge loop stop/go flag */ | |||
struct peer_info *curr_sn; /**< Cu rrently active supernode. */ | struct peer_info *curr_sn; /**< Cu rrently active supernode. */ | |||
uint8_t sn_wait; /**< Wh ether we are waiting for a supernode response. */ | uint8_t sn_wait; /**< Wh ether we are waiting for a supernode response. */ | |||
uint8_t sn_pong; /**< Wh ether we have seen a PONG since last time reset. */ | uint8_t sn_pong; /**< Wh ether we have seen a PONG since last time reset. */ | |||
size_t sup_attempts; /**< Nu mber of remaining attempts to this supernode. */ | size_t sup_attempts; /**< Nu mber of remaining attempts to this supernode. */ | |||
tuntap_dev device; /**< Al l about the TUNTAP device */ | tuntap_dev device; /**< Al l about the TUNTAP device */ | |||
n2n_trans_op_t transop; /**< Th e transop to use when encoding */ | n2n_trans_op_t transop; /**< Th e transop to use when encoding */ | |||
n2n_trans_op_t transop_lzo; /**< Th | ||||
e transop for LZO compression */ | ||||
#ifdef HAVE_ZSTD | ||||
n2n_trans_op_t transop_zstd; /**< Th | ||||
e transop for ZSTD compression */ | ||||
#endif | ||||
n2n_route_t *sn_route_to_clean; /**< Su pernode route to clean */ | n2n_route_t *sn_route_to_clean; /**< Su pernode route to clean */ | |||
n2n_edge_callbacks_t cb; /**< AP I callbacks */ | n2n_edge_callbacks_t cb; /**< AP I callbacks */ | |||
void *user_data; /**< Ca n hold user data */ | void *user_data; /**< Ca n hold user data */ | |||
SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_common_data; | SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_common_data; | |||
/* Sockets */ | /* Sockets */ | |||
/* supernode socket is in eee->curr_sn->sock (of type n2n_sock_t) */ | /* supernode socket is in eee->curr_sn->sock (of type n2n_sock_t) */ | |||
int sock; | int sock; | |||
int close_socket_counter; /**< co unter for close-event before re-opening */ | int close_socket_counter; /**< co unter for close-event before re-opening */ | |||
int udp_mgmt_sock; /**< so cket for status info. */ | int udp_mgmt_sock; /**< so cket for status info. */ | |||
skipping to change at line 708 | skipping to change at line 726 | |||
time_t last_p2p; /**< La st time p2p traffic was received. */ | time_t last_p2p; /**< La st time p2p traffic was received. */ | |||
time_t last_sup; /**< La st time a packet arrived from supernode. */ | time_t last_sup; /**< La st time a packet arrived from supernode. */ | |||
time_t last_sweep; /**< La st time a sweep was performed. */ | time_t last_sweep; /**< La st time a sweep was performed. */ | |||
time_t start_time; /**< Fo r calculating uptime */ | time_t start_time; /**< Fo r calculating uptime */ | |||
struct n2n_edge_stats stats; /**< St atistics */ | struct n2n_edge_stats stats; /**< St atistics */ | |||
n2n_resolve_parameter_t *resolve_parameter; /**< Po inter to name resolver's parameter block */ | n2n_resolve_parameter_t *resolve_parameter; /**< Po inter to name resolver's parameter block */ | |||
uint8_t resolution_request; /**< Fl ag an immediate DNS resolution request */ | uint8_t resolution_request; /**< Fl ag an immediate DNS resolution request */ | |||
n2n_port_map_parameter_t *port_map_parameter; /**< Po | ||||
inter to port mapping thread's parameter block */ | ||||
n2n_tuntap_priv_config_t tuntap_priv_conf; /**< Tu ntap config */ | n2n_tuntap_priv_config_t tuntap_priv_conf; /**< Tu ntap config */ | |||
network_traffic_filter_t *network_traffic_filter; | network_traffic_filter_t *network_traffic_filter; | |||
}; | }; | |||
typedef struct sn_stats { | typedef struct sn_stats { | |||
size_t errors; /* Number of errors encountered. */ | size_t errors; /* Number of errors encountered. */ | |||
size_t reg_super; /* Number of REGISTER_SUPER requests received. */ | size_t reg_super; /* Number of REGISTER_SUPER requests received. */ | |||
size_t reg_super_nak; /* Number of REGISTER_SUPER requests declined. */ | size_t reg_super_nak; /* Number of REGISTER_SUPER requests declined. */ | |||
size_t fwd; /* Number of messages forwarded. */ | size_t fwd; /* Number of messages forwarded. */ | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 26 lines changed or added |