| gnunet_ats_service.h | | gnunet_ats_service.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| * @author Matthias Wachs | | * @author Matthias Wachs | |
| */ | | */ | |
| #ifndef GNUNET_ATS_SERVICE_H | | #ifndef GNUNET_ATS_SERVICE_H | |
| #define GNUNET_ATS_SERVICE_H | | #define GNUNET_ATS_SERVICE_H | |
| | | | |
| #include "gnunet_constants.h" | | #include "gnunet_constants.h" | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
| #include "gnunet_hello_lib.h" | | #include "gnunet_hello_lib.h" | |
| | | | |
|
| | | /** | |
| | | * Number of network types supported by ATS | |
| | | */ | |
| | | #define GNUNET_ATS_NetworkTypeCount 5 | |
| | | | |
| | | /** | |
| | | * ATS network types as array initializer | |
| | | */ | |
| | | #define GNUNET_ATS_NetworkType {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_ | |
| | | LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN} | |
| | | | |
| | | /** | |
| | | * ATS network types as string array initializer | |
| | | */ | |
| | | #define GNUNET_ATS_NetworkTypeString {"UNSPECIFIED", "LOOPBACK", "LAN", "WA | |
| | | N", "WLAN"} | |
| | | | |
| enum GNUNET_ATS_Network_Type | | enum GNUNET_ATS_Network_Type | |
| { | | { | |
| GNUNET_ATS_NET_UNSPECIFIED = 0, | | GNUNET_ATS_NET_UNSPECIFIED = 0, | |
| GNUNET_ATS_NET_LOOPBACK = 1, | | GNUNET_ATS_NET_LOOPBACK = 1, | |
| GNUNET_ATS_NET_LAN = 2, | | GNUNET_ATS_NET_LAN = 2, | |
| GNUNET_ATS_NET_WAN = 3, | | GNUNET_ATS_NET_WAN = 3, | |
| GNUNET_ATS_NET_WLAN = 4, | | GNUNET_ATS_NET_WLAN = 4, | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * Default bandwidth assigned to a network : 64 KB/s | |
| | | */ | |
| | | #define GNUNET_ATS_DefaultBandwidth 65536 | |
| | | | |
| | | /** | |
| | | * Maximum bandwidth assigned to a network : 4095 MB/s | |
| | | */ | |
| | | #define GNUNET_ATS_MaxBandwidth UINT32_MAX | |
| | | | |
| | | /** | |
| | | * Number of property types supported by ATS | |
| | | */ | |
| | | #define GNUNET_ATS_PropertyCount 9 | |
| | | | |
| | | /** | |
| | | * ATS properties types as string array initializer | |
| | | */ | |
| | | #define GNUNET_ATS_PropertyStrings {"Terminator", "Utilization up", "Utiliz | |
| | | ation down", "Network type", "Delay", "Distance", "Cost WAN", "Cost LAN", " | |
| | | Cost WLAN"} | |
| | | | |
| | | /** | |
| * Enum defining all known property types for ATS Enum values are used | | * Enum defining all known property types for ATS Enum values are used | |
| * in the GNUNET_ATS_Information struct as | | * in the GNUNET_ATS_Information struct as | |
| * (key,value)-pairs. | | * (key,value)-pairs. | |
| * | | * | |
| * Cost are always stored in uint32_t, so all units used to define costs | | * Cost are always stored in uint32_t, so all units used to define costs | |
| * have to be normalized to fit in uint32_t [0 .. 4.294.967.295] | | * have to be normalized to fit in uint32_t [0 .. 4.294.967.295] | |
| */ | | */ | |
| enum GNUNET_ATS_Property | | enum GNUNET_ATS_Property | |
| { | | { | |
| | | | |
| | | | |
| skipping to change at line 415 | | skipping to change at line 450 | |
| * Number of ATS quality properties | | * Number of ATS quality properties | |
| */ | | */ | |
| #define GNUNET_ATS_QualityPropertiesCount 2 | | #define GNUNET_ATS_QualityPropertiesCount 2 | |
| | | | |
| /** | | /** | |
| * ATS quality properties as array initializer | | * ATS quality properties as array initializer | |
| */ | | */ | |
| #define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_
ATS_QUALITY_NET_DISTANCE} | | #define GNUNET_ATS_QualityProperties {GNUNET_ATS_QUALITY_NET_DELAY, GNUNET_
ATS_QUALITY_NET_DISTANCE} | |
| | | | |
| /** | | /** | |
|
| * Number of ATS quality properties | | * ATS quality properties as string array initializer | |
| */ | | */ | |
|
| #define GNUNET_ATS_NetworkTypeCount 5 | | #define GNUNET_ATS_QualityPropertiesString {"Delay", "Distance"} | |
| | | | |
| /** | | | |
| * ATS quality properties as array initializer | | | |
| */ | | | |
| #define GNUNET_ATS_NetworkType {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_ | | | |
| LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN} | | | |
| | | | |
| GNUNET_NETWORK_STRUCT_BEGIN | | GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| /** | | /** | |
| * struct used to communicate the transport's properties like cost and | | * struct used to communicate the transport's properties like cost and | |
| * quality of service as well as high-level constraints on resource | | * quality of service as well as high-level constraints on resource | |
| * consumption. | | * consumption. | |
| * | | * | |
| * +---+ | | * +---+ | |
| * +-----------+ Constraints | | Plugin properties +---------+ | | * +-----------+ Constraints | | Plugin properties +---------+ | |
| | | | |
| skipping to change at line 551 | | skipping to change at line 581 | |
| * We want to cancel ATS suggesting addresses for a peer. | | * We want to cancel ATS suggesting addresses for a peer. | |
| * | | * | |
| * @param sh handle | | * @param sh handle | |
| * @param peer identity of the peer | | * @param peer identity of the peer | |
| */ | | */ | |
| void | | void | |
| GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | | GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh, | |
| const struct GNUNET_PeerIdentity *peer); | | const struct GNUNET_PeerIdentity *peer); | |
| | | | |
| /** | | /** | |
|
| | | * Convert a GNUNET_ATS_NetworkType to a string | |
| | | * | |
| | | * @param net the network type | |
| | | * @return a string or NULL if invalid | |
| | | */ | |
| | | const char * | |
| | | GNUNET_ATS_print_network_type (uint32_t net); | |
| | | | |
| | | /** | |
| * Returns where the address is located: LAN or WAN or ... | | * Returns where the address is located: LAN or WAN or ... | |
| * @param sh the GNUNET_ATS_SchedulingHandle handle | | * @param sh the GNUNET_ATS_SchedulingHandle handle | |
| * @param addr address | | * @param addr address | |
| * @param addrlen address length | | * @param addrlen address length | |
| * @return location as GNUNET_ATS_Information | | * @return location as GNUNET_ATS_Information | |
| */ | | */ | |
| struct GNUNET_ATS_Information | | struct GNUNET_ATS_Information | |
| GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | | GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh, | |
| const struct sockaddr * addr, | | const struct sockaddr * addr, | |
| socklen_t addrlen); | | socklen_t addrlen); | |
| | | | |
| skipping to change at line 658 | | skipping to change at line 697 | |
| GNUNET_BANDWIDTH_Value3
2NBO | | GNUNET_BANDWIDTH_Value3
2NBO | |
| bandwidth_out, | | bandwidth_out, | |
| struct | | struct | |
| GNUNET_BANDWIDTH_Value3
2NBO | | GNUNET_BANDWIDTH_Value3
2NBO | |
| bandwidth_in, | | bandwidth_in, | |
| const struct | | const struct | |
| GNUNET_ATS_Information
* | | GNUNET_ATS_Information
* | |
| ats, uint32_t ats_count
); | | ats, uint32_t ats_count
); | |
| | | | |
| /** | | /** | |
|
| | | * Handle for an address listing operation | |
| | | */ | |
| | | struct GNUNET_ATS_AddressListHandle; | |
| | | | |
| | | /** | |
| * Get handle to access performance API of the ATS subsystem. | | * Get handle to access performance API of the ATS subsystem. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * @param infocb function to call on performance changes, can be NULL | | * @param infocb function to call on performance changes, can be NULL | |
| * @param infocb_cls closure for infocb | | * @param infocb_cls closure for infocb | |
| * @return ats performance context | | * @return ats performance context | |
| */ | | */ | |
| struct GNUNET_ATS_PerformanceHandle * | | struct GNUNET_ATS_PerformanceHandle * | |
| GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| GNUNET_ATS_PeerInformationCallback infocb, | | GNUNET_ATS_PeerInformationCallback infocb, | |
| void *infocb_cls); | | void *infocb_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Get information about addresses known to the ATS subsystem. | |
| | | * | |
| | | * @param handle the performance handle to use | |
| | | * @param peer peer idm can be NULL for all peers | |
| | | * @param all GNUNET_YES to get information about all addresses or GNUNET_N | |
| | | O to | |
| | | * get only address currently used | |
| | | * @param infocb callback to call with the addresses, | |
| | | * will callback with address == NULL when done | |
| | | * @param infocb_cls closure for infocb | |
| | | * @return ats performance context | |
| | | */ | |
| | | struct GNUNET_ATS_AddressListHandle * | |
| | | GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle | |
| | | *handle, | |
| | | const struct GNUNET_PeerIdentity *pe | |
| | | er, | |
| | | int all, | |
| | | GNUNET_ATS_PeerInformationCallback i | |
| | | nfocb, | |
| | | void *infocb_cls); | |
| | | | |
| | | /** | |
| | | * Cancel a pending address listing operation | |
| | | * | |
| | | * @param handle the GNUNET_ATS_AddressListHandle handle to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressList | |
| | | Handle *handle); | |
| | | | |
| | | /** | |
| * Client is done using the ATS performance subsystem, release resources. | | * Client is done using the ATS performance subsystem, release resources. | |
| * | | * | |
| * @param ph handle | | * @param ph handle | |
| */ | | */ | |
| void | | void | |
| GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); | | GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); | |
| | | | |
| /** | | /** | |
| * Function called with reservation result. | | * Function called with reservation result. | |
| * | | * | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 800 | |
| | | | |
| /** | | /** | |
| * Cancel request for reserving bandwidth. | | * Cancel request for reserving bandwidth. | |
| * | | * | |
| * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth
call | | * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth
call | |
| */ | | */ | |
| void | | void | |
| GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *
rc); | | GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *
rc); | |
| | | | |
| /** | | /** | |
|
| | | * Number of preference types supported by ATS | |
| | | */ | |
| | | #define GNUNET_ATS_PreferenceCount 3 | |
| | | | |
| | | /** | |
| | | * ATS preference types as array initializer | |
| | | */ | |
| | | #define GNUNET_ATS_PreferenceType {GNUNET_ATS_PREFERENCE_END, GNUNET_ATS_PR | |
| | | EFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY} | |
| | | | |
| | | /** | |
| | | * ATS preference types as string array initializer | |
| | | */ | |
| | | #define GNUNET_ATS_PreferenceTypeString {"END", "BANDWIDTH", "LATENCY"} | |
| | | | |
| | | /** | |
| * Enum defining all known preference categories. | | * Enum defining all known preference categories. | |
| */ | | */ | |
| enum GNUNET_ATS_PreferenceKind | | enum GNUNET_ATS_PreferenceKind | |
| { | | { | |
| | | | |
| /** | | /** | |
| * End of preference list. | | * End of preference list. | |
| */ | | */ | |
| GNUNET_ATS_PREFERENCE_END = 0, | | GNUNET_ATS_PREFERENCE_END = 0, | |
| | | | |
| | | | |
| skipping to change at line 758 | | skipping to change at line 844 | |
| * Change the peer's latency value to the given amount. The | | * Change the peer's latency value to the given amount. The | |
| * argument is followed by a double value giving the desired value | | * argument is followed by a double value giving the desired value | |
| * (can be negative). The absolute score in the goal function is | | * (can be negative). The absolute score in the goal function is | |
| * the inverse of the latency in ms (minimum: 1 ms) multiplied by | | * the inverse of the latency in ms (minimum: 1 ms) multiplied by | |
| * the latency preferences. | | * the latency preferences. | |
| */ | | */ | |
| GNUNET_ATS_PREFERENCE_LATENCY | | GNUNET_ATS_PREFERENCE_LATENCY | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * Convert a GNUNET_ATS_PreferenceType to a string | |
| | | * | |
| | | * @param type the preference type | |
| | | * @return a string or NULL if invalid | |
| | | */ | |
| | | const char * | |
| | | GNUNET_ATS_print_preference_type (uint32_t type); | |
| | | | |
| | | /** | |
| * Change preferences for the given peer. Preference changes are forgotten
if peers | | * Change preferences for the given peer. Preference changes are forgotten
if peers | |
| * disconnect. | | * disconnect. | |
| * | | * | |
| * @param ph performance handle | | * @param ph performance handle | |
| * @param peer identifies the peer | | * @param peer identifies the peer | |
| * @param ... 0-terminated specification of the desired changes | | * @param ... 0-terminated specification of the desired changes | |
| */ | | */ | |
| void | | void | |
| GNUNET_ATS_change_preference (struct GNUNET_ATS_PerformanceHandle *ph, | | GNUNET_ATS_change_preference (struct GNUNET_ATS_PerformanceHandle *ph, | |
| const struct GNUNET_PeerIdentity *peer, ...); | | const struct GNUNET_PeerIdentity *peer, ...); | |
| | | | |
End of changes. 9 change blocks. |
| 8 lines changed or deleted | | 112 lines changed or added | |
|
| gnunet_disk_lib.h | | gnunet_disk_lib.h | |
| /* | | /* | |
| This file is part of GNUnet. | | This file is part of GNUnet. | |
|
| (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 Christian Grothoff (and o
ther contributing authors) | | (C) 2001-2012 Christian Grothoff (and other contributing authors) | |
| | | | |
| GNUnet is free software; you can redistribute it and/or modify | | GNUnet is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published | | it under the terms of the GNU General Public License as published | |
| by the Free Software Foundation; either version 2, or (at your | | by the Free Software Foundation; either version 2, or (at your | |
| option) any later version. | | option) any later version. | |
| | | | |
| GNUnet is distributed in the hope that it will be useful, but | | GNUnet is distributed in the hope that it will be useful, but | |
| WITHOUT ANY WARRANTY; without even the implied warranty of | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| General Public License for more details. | | General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with GNUnet; see the file COPYING. If not, write to the | | along with GNUnet; see the file COPYING. If not, write to the | |
| Free Software Foundation, Inc., 59 Temple Place - Suite 330, | | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| Boston, MA 02111-1307, USA. | | Boston, MA 02111-1307, USA. | |
| */ | | */ | |
|
| | | | |
| /** | | /** | |
| * @file include/gnunet_disk_lib.h | | * @file include/gnunet_disk_lib.h | |
| * @brief disk IO apis | | * @brief disk IO apis | |
|
| | | * @author Christian Grothoff | |
| */ | | */ | |
| #ifndef GNUNET_DISK_LIB_H | | #ifndef GNUNET_DISK_LIB_H | |
| #define GNUNET_DISK_LIB_H | | #define GNUNET_DISK_LIB_H | |
| | | | |
| #if WINDOWS | | #if WINDOWS | |
| #define OFF_T uint64_t | | #define OFF_T uint64_t | |
| #else | | #else | |
| #define OFF_T off_t | | #define OFF_T off_t | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 88 | |
| * Structure for overlapped writing (for pipes) | | * Structure for overlapped writing (for pipes) | |
| */ | | */ | |
| OVERLAPPED *oOverlapWrite; | | OVERLAPPED *oOverlapWrite; | |
| #else | | #else | |
| | | | |
| /** | | /** | |
| * File handle on other OSes. | | * File handle on other OSes. | |
| */ | | */ | |
| int fd; | | int fd; | |
| | | | |
|
| #endif /* | | #endif | |
| */ | | | |
| }; | | }; | |
| | | | |
| /* we need size_t, and since it can be both unsigned int | | /* we need size_t, and since it can be both unsigned int | |
| or unsigned long long, this IS platform dependent; | | or unsigned long long, this IS platform dependent; | |
| but "stdlib.h" should be portable 'enough' to be | | but "stdlib.h" should be portable 'enough' to be | |
| unconditionally available... */ | | unconditionally available... */ | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include "gnunet_configuration_lib.h" | | #include "gnunet_configuration_lib.h" | |
| #include "gnunet_scheduler_lib.h" | | #include "gnunet_scheduler_lib.h" | |
| | | | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 113 | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Specifies how a file should be opened. | | * Specifies how a file should be opened. | |
| */ | | */ | |
| enum GNUNET_DISK_OpenFlags | | enum GNUNET_DISK_OpenFlags | |
| { | | { | |
| | | | |
|
| /** | | /** | |
| * Open the file for reading | | * Open the file for reading | |
| */ | | */ | |
| GNUNET_DISK_OPEN_READ = 1, | | GNUNET_DISK_OPEN_READ = 1, | |
| | | | |
|
| /** | | /** | |
| * Open the file for writing | | * Open the file for writing | |
| */ | | */ | |
| GNUNET_DISK_OPEN_WRITE = 2, | | GNUNET_DISK_OPEN_WRITE = 2, | |
| | | | |
|
| /** | | /** | |
| * Open the file for both reading and writing | | * Open the file for both reading and writing | |
| */ | | */ | |
| GNUNET_DISK_OPEN_READWRITE = 3, | | GNUNET_DISK_OPEN_READWRITE = 3, | |
| | | | |
|
| /** | | /** | |
| * Fail if file already exists | | * Fail if file already exists | |
| */ | | */ | |
| GNUNET_DISK_OPEN_FAILIFEXISTS = 4, | | GNUNET_DISK_OPEN_FAILIFEXISTS = 4, | |
| | | | |
|
| /** | | /** | |
| * Truncate file if it exists | | * Truncate file if it exists | |
| */ | | */ | |
| GNUNET_DISK_OPEN_TRUNCATE = 8, | | GNUNET_DISK_OPEN_TRUNCATE = 8, | |
| | | | |
|
| /** | | /** | |
| * Create file if it doesn't exist | | * Create file if it doesn't exist | |
| */ | | */ | |
| GNUNET_DISK_OPEN_CREATE = 16, | | GNUNET_DISK_OPEN_CREATE = 16, | |
| | | | |
|
| /** | | /** | |
| * Append to the file | | * Append to the file | |
| */ | | */ | |
| GNUNET_DISK_OPEN_APPEND = 32 | | GNUNET_DISK_OPEN_APPEND = 32 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Specifies what type of memory map is desired. | | * Specifies what type of memory map is desired. | |
| */ | | */ | |
| enum GNUNET_DISK_MapType | | enum GNUNET_DISK_MapType | |
| { | | { | |
|
| /** | | /** | |
| * Read-only memory map. | | * Read-only memory map. | |
| */ | | */ | |
| GNUNET_DISK_MAP_TYPE_READ = 1, | | GNUNET_DISK_MAP_TYPE_READ = 1, | |
| | | | |
|
| /** | | /** | |
| * Write-able memory map. | | * Write-able memory map. | |
| */ | | */ | |
| GNUNET_DISK_MAP_TYPE_WRITE = 2, | | GNUNET_DISK_MAP_TYPE_WRITE = 2, | |
|
| /** | | | |
| * Read-write memory map. | | /** | |
| */ | | * Read-write memory map. | |
| | | */ | |
| GNUNET_DISK_MAP_TYPE_READWRITE = 3 | | GNUNET_DISK_MAP_TYPE_READWRITE = 3 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * File access permissions, UNIX-style. | | * File access permissions, UNIX-style. | |
| */ | | */ | |
| enum GNUNET_DISK_AccessPermissions | | enum GNUNET_DISK_AccessPermissions | |
| { | | { | |
|
| /** | | /** | |
| * Nobody is allowed to do anything to the file. | | * Nobody is allowed to do anything to the file. | |
| */ | | */ | |
| GNUNET_DISK_PERM_NONE = 0, | | GNUNET_DISK_PERM_NONE = 0, | |
| | | | |
|
| /** | | /** | |
| * Owner can read. | | * Owner can read. | |
| */ | | */ | |
| GNUNET_DISK_PERM_USER_READ = 1, | | GNUNET_DISK_PERM_USER_READ = 1, | |
| | | | |
|
| /** | | /** | |
| * Owner can write. | | * Owner can write. | |
| */ | | */ | |
| GNUNET_DISK_PERM_USER_WRITE = 2, | | GNUNET_DISK_PERM_USER_WRITE = 2, | |
| | | | |
|
| /** | | /** | |
| * Owner can execute. | | * Owner can execute. | |
| */ | | */ | |
| GNUNET_DISK_PERM_USER_EXEC = 4, | | GNUNET_DISK_PERM_USER_EXEC = 4, | |
| | | | |
|
| /** | | /** | |
| * Group can read. | | * Group can read. | |
| */ | | */ | |
| GNUNET_DISK_PERM_GROUP_READ = 8, | | GNUNET_DISK_PERM_GROUP_READ = 8, | |
| | | | |
|
| /** | | /** | |
| * Group can write. | | * Group can write. | |
| */ | | */ | |
| GNUNET_DISK_PERM_GROUP_WRITE = 16, | | GNUNET_DISK_PERM_GROUP_WRITE = 16, | |
| | | | |
|
| /** | | /** | |
| * Group can execute. | | * Group can execute. | |
| */ | | */ | |
| GNUNET_DISK_PERM_GROUP_EXEC = 32, | | GNUNET_DISK_PERM_GROUP_EXEC = 32, | |
| | | | |
|
| /** | | /** | |
| * Everybody can read. | | * Everybody can read. | |
| */ | | */ | |
| GNUNET_DISK_PERM_OTHER_READ = 64, | | GNUNET_DISK_PERM_OTHER_READ = 64, | |
| | | | |
|
| /** | | /** | |
| * Everybody can write. | | * Everybody can write. | |
| */ | | */ | |
| GNUNET_DISK_PERM_OTHER_WRITE = 128, | | GNUNET_DISK_PERM_OTHER_WRITE = 128, | |
| | | | |
|
| /** | | /** | |
| * Everybody can execute. | | * Everybody can execute. | |
| */ | | */ | |
| GNUNET_DISK_PERM_OTHER_EXEC = 256 | | GNUNET_DISK_PERM_OTHER_EXEC = 256 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Constants for specifying how to seek. Do not change values or order, | | * Constants for specifying how to seek. Do not change values or order, | |
| * some of the code depends on the specific numeric values! | | * some of the code depends on the specific numeric values! | |
| */ | | */ | |
| enum GNUNET_DISK_Seek | | enum GNUNET_DISK_Seek | |
| { | | { | |
|
| /** | | /** | |
| * Seek an absolute position (from the start of the file). | | * Seek an absolute position (from the start of the file). | |
| */ | | */ | |
| GNUNET_DISK_SEEK_SET = 0, | | GNUNET_DISK_SEEK_SET = 0, | |
| | | | |
|
| /** | | /** | |
| * Seek a relative position (from the current offset). | | * Seek a relative position (from the current offset). | |
| */ | | */ | |
| GNUNET_DISK_SEEK_CUR = 1, | | GNUNET_DISK_SEEK_CUR = 1, | |
| | | | |
|
| /** | | /** | |
| * Seek an absolute position from the end of the file. | | * Seek an absolute position from the end of the file. | |
| */ | | */ | |
| GNUNET_DISK_SEEK_END = 2 | | GNUNET_DISK_SEEK_END = 2 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Enumeration identifying the two ends of a pipe. | | * Enumeration identifying the two ends of a pipe. | |
| */ | | */ | |
| enum GNUNET_DISK_PipeEnd | | enum GNUNET_DISK_PipeEnd | |
| { | | { | |
|
| /** | | /** | |
| * The reading-end of a pipe. | | * The reading-end of a pipe. | |
| */ | | */ | |
| GNUNET_DISK_PIPE_END_READ = 0, | | GNUNET_DISK_PIPE_END_READ = 0, | |
| | | | |
|
| /** | | /** | |
| * The writing-end of a pipe. | | * The writing-end of a pipe. | |
| */ | | */ | |
| GNUNET_DISK_PIPE_END_WRITE = 1 | | GNUNET_DISK_PIPE_END_WRITE = 1 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Get the number of blocks that are left on the partition that | | * Get the number of blocks that are left on the partition that | |
| * contains the given file (for normal users). | | * contains the given file (for normal users). | |
| * | | * | |
| * @param part a file on the partition to check | | * @param part a file on the partition to check | |
| * @return -1 on errors, otherwise the number of free blocks | | * @return -1 on errors, otherwise the number of free blocks | |
| */ | | */ | |
| | | | |
| skipping to change at line 295 | | skipping to change at line 295 | |
| * (of a file that exists and that is not a directory). | | * (of a file that exists and that is not a directory). | |
| * | | * | |
| * @param fil filename to check | | * @param fil filename to check | |
| * @return GNUNET_YES if yes, GNUNET_NO if not a file, GNUNET_SYSERR if som
ething | | * @return GNUNET_YES if yes, GNUNET_NO if not a file, GNUNET_SYSERR if som
ething | |
| * else (will print an error message in that case, too). | | * else (will print an error message in that case, too). | |
| */ | | */ | |
| int | | int | |
| GNUNET_DISK_file_test (const char *fil); | | GNUNET_DISK_file_test (const char *fil); | |
| | | | |
| /** | | /** | |
|
| | | * Move a file out of the way (create a backup) by | |
| | | * renaming it to "orig.NUM~" where NUM is the smallest | |
| | | * number that is not used yet. | |
| | | * | |
| | | * @param fil name of the file to back up | |
| | | */ | |
| | | void | |
| | | GNUNET_DISK_file_backup (const char *fil); | |
| | | | |
| | | /** | |
| * Move the read/write pointer in a file | | * Move the read/write pointer in a file | |
| * @param h handle of an open file | | * @param h handle of an open file | |
| * @param offset position to move to | | * @param offset position to move to | |
| * @param whence specification to which position the offset parameter relat
es to | | * @param whence specification to which position the offset parameter relat
es to | |
| * @return the new position on success, GNUNET_SYSERR otherwise | | * @return the new position on success, GNUNET_SYSERR otherwise | |
| */ | | */ | |
| OFF_T | | OFF_T | |
| GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset
, | | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset
, | |
| enum GNUNET_DISK_Seek whence); | | enum GNUNET_DISK_Seek whence); | |
| | | | |
| | | | |
| skipping to change at line 632 | | skipping to change at line 642 | |
| * a file. | | * a file. | |
| * | | * | |
| * @param filename name of a file in the directory | | * @param filename name of a file in the directory | |
| * @returns GNUNET_OK on success, GNUNET_SYSERR on failure, | | * @returns GNUNET_OK on success, GNUNET_SYSERR on failure, | |
| * GNUNET_NO if directory exists but is not writeable | | * GNUNET_NO if directory exists but is not writeable | |
| */ | | */ | |
| int | | int | |
| GNUNET_DISK_directory_create_for_file (const char *filename); | | GNUNET_DISK_directory_create_for_file (const char *filename); | |
| | | | |
| /** | | /** | |
|
| * Test if "fil" is a directory that can be accessed. | | * Test if "fil" is a directory and listable. Optionally, also check if the | |
| * Will not print an error message if the directory | | * directory is readable. Will not print an error message if the directory | |
| * does not exist. Will log errors if GNUNET_SYSERR is | | does | |
| * returned. | | * not exist. Will log errors if GNUNET_SYSERR is returned (i.e., a file e | |
| | | xists | |
| | | * with the same name). | |
| * | | * | |
| * @param fil filename to test | | * @param fil filename to test | |
|
| * @return GNUNET_YES if yes, GNUNET_NO if does not exist, GNUNET_SYSERR | | * @param is_readable GNUNET_YES to additionally check if "fil" is readable | |
| * on any error and if exists but not directory | | ; | |
| | | * GNUNET_NO to disable this check | |
| | | * @return GNUNET_YES if yes, GNUNET_NO if not; GNUNET_SYSERR if it | |
| | | * does not exist or stat'ed | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_DISK_directory_test (const char *fil); | | GNUNET_DISK_directory_test (const char *fil, int is_readable); | |
| | | | |
| /** | | /** | |
| * Remove all files in a directory (rm -rf). Call with | | * Remove all files in a directory (rm -rf). Call with | |
| * caution. | | * caution. | |
| * | | * | |
| * @param filename the file to remove | | * @param filename the file to remove | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
| GNUNET_DISK_directory_remove (const char *filename); | | GNUNET_DISK_directory_remove (const char *filename); | |
| | | | |
End of changes. 33 change blocks. |
| 86 lines changed or deleted | | 101 lines changed or added | |
|
| gnunet_stream_lib.h | | gnunet_stream_lib.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #include "gnunet_mesh_service.h" | | #include "gnunet_mesh_service.h" | |
| | | | |
| /** | | /** | |
| * Stream status | | * Stream status | |
| */ | | */ | |
| enum GNUNET_STREAM_Status | | enum GNUNET_STREAM_Status | |
| { | | { | |
| /** | | /** | |
| * All previous read/write operations are successfully done | | * All previous read/write operations are successfully done | |
| */ | | */ | |
|
| GNUNET_STREAM_OK = 0, | | GNUNET_STREAM_OK, | |
| | | | |
| /** | | /** | |
| * A timeout occured while reading/writing the stream | | * A timeout occured while reading/writing the stream | |
| */ | | */ | |
|
| GNUNET_STREAM_TIMEOUT = 1, | | GNUNET_STREAM_TIMEOUT, | |
| | | | |
| /** | | /** | |
| * Other side has shutdown the socket for this type of operation | | * Other side has shutdown the socket for this type of operation | |
| * (reading/writing) | | * (reading/writing) | |
| */ | | */ | |
|
| GNUNET_STREAM_SHUTDOWN = 2, | | GNUNET_STREAM_SHUTDOWN, | |
| | | | |
| /** | | /** | |
| * A serious error occured while operating on this stream | | * A serious error occured while operating on this stream | |
| */ | | */ | |
|
| GNUNET_STREAM_SYSERR = 3, | | GNUNET_STREAM_SYSERR | |
| | | | |
| /** | | | |
| * An error resulted in an unusable stream | | | |
| */ | | | |
| GNUNET_STREAM_BROKEN | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Opaque handler for stream | | * Opaque handler for stream | |
| */ | | */ | |
| struct GNUNET_STREAM_Socket; | | struct GNUNET_STREAM_Socket; | |
| | | | |
| /** | | /** | |
| * Functions of this type will be called when a stream is established | | * Functions of this type will be called when a stream is established | |
| * | | * | |
| | | | |
| skipping to change at line 193 | | skipping to change at line 188 | |
| * @param completion_cls the closure for the completion callback | | * @param completion_cls the closure for the completion callback | |
| * @return the shutdown handle; NULL in case of any error | | * @return the shutdown handle; NULL in case of any error | |
| */ | | */ | |
| struct GNUNET_STREAM_ShutdownHandle * | | struct GNUNET_STREAM_ShutdownHandle * | |
| GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, | |
| int operation, | | int operation, | |
| GNUNET_STREAM_ShutdownCompletion completion_cb, | | GNUNET_STREAM_ShutdownCompletion completion_cb, | |
| void *completion_cls); | | void *completion_cls); | |
| | | | |
| /** | | /** | |
|
| * Cancels a pending shutdown | | * Cancels a pending shutdown. Note that the shutdown messages may already | |
| | | * be sent and the stream is shutdown already for the operation given to | |
| | | * GNUNET_STREAM_shutdown(). This function only clears up any retranmission | |
| | | s of | |
| | | * shutdown messages and frees the shutdown handle. | |
| * | | * | |
| * @param handle the shutdown handle returned from GNUNET_STREAM_shutdown | | * @param handle the shutdown handle returned from GNUNET_STREAM_shutdown | |
| */ | | */ | |
| void | | void | |
| GNUNET_STREAM_shutdown_cancel (struct GNUNET_STREAM_ShutdownHandle *handle)
; | | GNUNET_STREAM_shutdown_cancel (struct GNUNET_STREAM_ShutdownHandle *handle)
; | |
| | | | |
| /** | | /** | |
| * Closes the stream and frees the associated state. The stream should be | | * Closes the stream and frees the associated state. The stream should be | |
|
| * shutdown before closing. | | * shutdown for both reading and writing before closing. | |
| * | | * | |
| * @param socket the stream socket | | * @param socket the stream socket | |
| */ | | */ | |
| void | | void | |
| GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket); | | GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket); | |
| | | | |
| /** | | /** | |
| * Functions of this type are called upon new stream connection from other
peers | | * Functions of this type are called upon new stream connection from other
peers | |
| * or upon binding error which happen when the app_port given in | | * or upon binding error which happen when the app_port given in | |
| * GNUNET_STREAM_listen() is already taken. | | * GNUNET_STREAM_listen() is already taken. | |
| | | | |
| skipping to change at line 235 | | skipping to change at line 233 | |
| | | | |
| /** | | /** | |
| * A socket for listening. | | * A socket for listening. | |
| */ | | */ | |
| struct GNUNET_STREAM_ListenSocket; | | struct GNUNET_STREAM_ListenSocket; | |
| | | | |
| /** | | /** | |
| * Listens for stream connections for a specific application ports | | * Listens for stream connections for a specific application ports | |
| * | | * | |
| * @param cfg the configuration to use | | * @param cfg the configuration to use | |
|
| * | | | |
| * @param app_port the application port for which new streams will be | | * @param app_port the application port for which new streams will be | |
| * accepted. If another stream is listening on the same port the | | * accepted. If another stream is listening on the same port the | |
| * listen_cb will be called to signal binding error and the returne
d | | * listen_cb will be called to signal binding error and the returne
d | |
| * ListenSocket will be invalidated. | | * ListenSocket will be invalidated. | |
|
| * | | | |
| * @param listen_cb this function will be called when a peer tries to estab
lish | | * @param listen_cb this function will be called when a peer tries to estab
lish | |
| * a stream with us | | * a stream with us | |
| * @param listen_cb_cls closure for listen_cb | | * @param listen_cb_cls closure for listen_cb | |
| * @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END | | * @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END | |
| * @return listen socket, NULL for any error | | * @return listen socket, NULL for any error | |
| */ | | */ | |
| struct GNUNET_STREAM_ListenSocket * | | struct GNUNET_STREAM_ListenSocket * | |
| GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| GNUNET_MESH_ApplicationType app_port, | | GNUNET_MESH_ApplicationType app_port, | |
| GNUNET_STREAM_ListenCallback listen_cb, | | GNUNET_STREAM_ListenCallback listen_cb, | |
| | | | |
| skipping to change at line 267 | | skipping to change at line 263 | |
| * @param lsocket the listen socket | | * @param lsocket the listen socket | |
| */ | | */ | |
| void | | void | |
| GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket); | | GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket); | |
| | | | |
| /** | | /** | |
| * Functions of this signature are called whenever writing operations | | * Functions of this signature are called whenever writing operations | |
| * on a stream are executed | | * on a stream are executed | |
| * | | * | |
| * @param cls the closure from GNUNET_STREAM_write | | * @param cls the closure from GNUNET_STREAM_write | |
|
| * @param status the status of the stream at the time this function is call | | * @param status the status of the stream at the time this function is call | |
| ed | | ed; | |
| | | * GNUNET_STREAM_OK if writing to stream was completed successfull | |
| | | y; | |
| | | * GNUNET_STREAM_TIMEOUT if the given data is not sent successfull | |
| | | y | |
| | | * (this doesn't mean that the data is never sent, the receiver ma | |
| | | y | |
| | | * have read the data but its ACKs may have been lost); | |
| | | * GNUNET_STREAM_SHUTDOWN if the stream is shutdown for writing in | |
| | | the | |
| | | * mean time; GNUNET_STREAM_SYSERR if the stream is broken and can | |
| | | not | |
| | | * be processed. | |
| * @param size the number of bytes written | | * @param size the number of bytes written | |
| */ | | */ | |
| typedef void (*GNUNET_STREAM_CompletionContinuation) (void *cls, | | typedef void (*GNUNET_STREAM_CompletionContinuation) (void *cls, | |
| enum GNUNET_STREAM_Sta
tus | | enum GNUNET_STREAM_Sta
tus | |
| status, | | status, | |
| size_t size); | | size_t size); | |
| | | | |
| /** | | /** | |
| * Handle to cancel IO write operations. | | * Handle to cancel IO write operations. | |
| */ | | */ | |
|
| struct GNUNET_STREAM_IOWriteHandle; | | struct GNUNET_STREAM_WriteHandle; | |
| | | | |
| /** | | /** | |
| * Handle to cancel IO read operations. | | * Handle to cancel IO read operations. | |
| */ | | */ | |
|
| struct GNUNET_STREAM_IOReadHandle; | | struct GNUNET_STREAM_ReadHandle; | |
| | | | |
| /** | | /** | |
| * Tries to write the given data to the stream. The maximum size of data th
at | | * Tries to write the given data to the stream. The maximum size of data th
at | |
| * can be written as part of a write operation is (64 * (64000 - sizeof (st
ruct | | * can be written as part of a write operation is (64 * (64000 - sizeof (st
ruct | |
| * GNUNET_STREAM_DataMessage))). If size is greater than this it is not an
API | | * GNUNET_STREAM_DataMessage))). If size is greater than this it is not an
API | |
| * violation, however only the said number of maximum bytes will be written
. | | * violation, however only the said number of maximum bytes will be written
. | |
| * | | * | |
| * @param socket the socket representing a stream | | * @param socket the socket representing a stream | |
| * @param data the data buffer from where the data is written into the stre
am | | * @param data the data buffer from where the data is written into the stre
am | |
| * @param size the number of bytes to be written from the data buffer | | * @param size the number of bytes to be written from the data buffer | |
| * @param timeout the timeout period | | * @param timeout the timeout period | |
| * @param write_cont the function to call upon writing some bytes into the | | * @param write_cont the function to call upon writing some bytes into the | |
| * stream | | * stream | |
| * @param write_cont_cls the closure | | * @param write_cont_cls the closure | |
| * | | * | |
|
| * @return handle to cancel the operation; if a previous write is pending o | | * @return handle to cancel the operation; if a previous write is pending N | |
| r | | ULL | |
| * the stream has been shutdown for this operation then write_con | | * is returned. If the stream has been shutdown for this operatio | |
| t is | | n or | |
| * immediately called and NULL is returned. | | * is broken then write_cont is immediately called and NULL is | |
| | | * returned. | |
| */ | | */ | |
|
| struct GNUNET_STREAM_IOWriteHandle * | | struct GNUNET_STREAM_WriteHandle * | |
| GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | |
| const void *data, | | const void *data, | |
| size_t size, | | size_t size, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_STREAM_CompletionContinuation write_cont, | | GNUNET_STREAM_CompletionContinuation write_cont, | |
| void *write_cont_cls); | | void *write_cont_cls); | |
| | | | |
| /** | | /** | |
| * Functions of this signature are called whenever data is available from t
he | | * Functions of this signature are called whenever data is available from t
he | |
| * stream. | | * stream. | |
| | | | |
| skipping to change at line 328 | | skipping to change at line 332 | |
| * @param size the number of bytes available in data read; will be 0 on tim
eout | | * @param size the number of bytes available in data read; will be 0 on tim
eout | |
| * @return number of bytes of processed from 'data' (any data remaining sho
uld be | | * @return number of bytes of processed from 'data' (any data remaining sho
uld be | |
| * given to the next time the read processor is called). | | * given to the next time the read processor is called). | |
| */ | | */ | |
| typedef size_t (*GNUNET_STREAM_DataProcessor) (void *cls, | | typedef size_t (*GNUNET_STREAM_DataProcessor) (void *cls, | |
| enum GNUNET_STREAM_Status st
atus, | | enum GNUNET_STREAM_Status st
atus, | |
| const void *data, | | const void *data, | |
| size_t size); | | size_t size); | |
| | | | |
| /** | | /** | |
|
| * Tries to read data from the stream. | | * Tries to read data from the stream. Should not be called when another re | |
| | | ad | |
| | | * handle is present; the existing read handle should be canceled with | |
| | | * GNUNET_STREAM_read_cancel(). Only one read handle per socket is present | |
| | | at | |
| | | * any time | |
| * | | * | |
| * @param socket the socket representing a stream | | * @param socket the socket representing a stream | |
| * @param timeout the timeout period | | * @param timeout the timeout period | |
| * @param proc function to call with data (once only) | | * @param proc function to call with data (once only) | |
| * @param proc_cls the closure for proc | | * @param proc_cls the closure for proc | |
|
| * | | * @return handle to cancel the operation; NULL is returned if the stream h | |
| * @return handle to cancel the operation; NULL is returned if: the stream | | as | |
| has | | | |
| * been shutdown for this type of opeartion (the DataProcessor is | | * been shutdown for this type of opeartion (the DataProcessor is | |
|
| * immediately called with GNUNET_STREAM_SHUTDOWN as status) OR a | | * immediately called with GNUNET_STREAM_SHUTDOWN as status) | |
| nother | | | |
| * read handle is present (only one read handle per socket is pre | | | |
| sent | | | |
| * at any time) | | | |
| */ | | */ | |
|
| struct GNUNET_STREAM_IOReadHandle * | | struct GNUNET_STREAM_ReadHandle * | |
| GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_STREAM_DataProcessor proc, | | GNUNET_STREAM_DataProcessor proc, | |
| void *proc_cls); | | void *proc_cls); | |
| | | | |
| /** | | /** | |
| * Cancels pending write operation. Also cancels packet retransmissions whi
ch | | * Cancels pending write operation. Also cancels packet retransmissions whi
ch | |
| * may have resulted otherwise. | | * may have resulted otherwise. | |
| * | | * | |
| * CAUTION: Normally a write operation is considered successful if the data | | * CAUTION: Normally a write operation is considered successful if the data | |
| * given to it is sent and acknowledged by the receiver. As data is divided | | * given to it is sent and acknowledged by the receiver. As data is divided | |
| * into packets, it is possible that not all packets are received by the | | * into packets, it is possible that not all packets are received by the | |
| * receiver. Any missing packets are then retransmitted till the receiver | | * receiver. Any missing packets are then retransmitted till the receiver | |
| * acknowledges all packets or until a timeout . During this scenario if th
e | | * acknowledges all packets or until a timeout . During this scenario if th
e | |
| * write operation is cancelled all such retransmissions are also | | * write operation is cancelled all such retransmissions are also | |
| * cancelled. This may leave the receiver's receive buffer incompletely fil
led | | * cancelled. This may leave the receiver's receive buffer incompletely fil
led | |
| * as some missing packets are never retransmitted. So this operation shoul
d be | | * as some missing packets are never retransmitted. So this operation shoul
d be | |
| * used before shutting down transmission from our side or before closing t
he | | * used before shutting down transmission from our side or before closing t
he | |
| * socket. | | * socket. | |
| * | | * | |
|
| * @param ioh handle to operation to cancel | | * @param wh write operation handle to cancel | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *iowh); | | GNUNET_STREAM_write_cancel (struct GNUNET_STREAM_WriteHandle *wh); | |
| | | | |
| /** | | /** | |
| * Cancel pending read operation. | | * Cancel pending read operation. | |
| * | | * | |
|
| * @param ioh handle to operation to cancel | | * @param rh read operation handle to cancel | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *iorh); | | GNUNET_STREAM_read_cancel (struct GNUNET_STREAM_ReadHandle *rh); | |
| | | | |
| #if 0 | | #if 0 | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* STREAM_PROTOCOL_H */ | | #endif /* STREAM_PROTOCOL_H */ | |
| | | | |
End of changes. 21 change blocks. |
| 37 lines changed or deleted | | 47 lines changed or added | |
|
| gnunet_testbed_service.h | | gnunet_testbed_service.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| * @file include/gnunet_testbed_service.h | | * @file include/gnunet_testbed_service.h | |
| * @brief API for writing tests and creating large-scale | | * @brief API for writing tests and creating large-scale | |
| * emulation testbeds for GNUnet. | | * emulation testbeds for GNUnet. | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| */ | | */ | |
| | | | |
| #ifndef GNUNET_TESTBED_SERVICE_H | | #ifndef GNUNET_TESTBED_SERVICE_H | |
| #define GNUNET_TESTBED_SERVICE_H | | #define GNUNET_TESTBED_SERVICE_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
|
| #include "gnunet_testing_lib-new.h" | | #include "gnunet_testing_lib.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 72 | |
| * controller has at least one master handle which is created when the | | * controller has at least one master handle which is created when the | |
| * controller is created; this master handle interacts with the | | * controller is created; this master handle interacts with the | |
| * controller process, destroying it destroys the controller (by | | * controller process, destroying it destroys the controller (by | |
| * closing stdin of the controller process). Additionally, | | * closing stdin of the controller process). Additionally, | |
| * controllers can interact with each other (in a P2P fashion); those | | * controllers can interact with each other (in a P2P fashion); those | |
| * links are established via TCP/IP on the controller's service port. | | * links are established via TCP/IP on the controller's service port. | |
| */ | | */ | |
| struct GNUNET_TESTBED_Controller; | | struct GNUNET_TESTBED_Controller; | |
| | | | |
| /** | | /** | |
|
| * Handle to a large-scale testbed that is managed at a high level. | | | |
| */ | | | |
| struct GNUNET_TESTBED_Testbed; | | | |
| | | | |
| /** | | | |
| * Create a host to run peers and controllers on. | | * Create a host to run peers and controllers on. | |
| * | | * | |
| * @param hostname name of the host, use "NULL" for localhost | | * @param hostname name of the host, use "NULL" for localhost | |
| * @param username username to use for the login; may be NULL | | * @param username username to use for the login; may be NULL | |
| * @param port port number to use for ssh; use 0 to let ssh decide | | * @param port port number to use for ssh; use 0 to let ssh decide | |
| * @return handle to the host, NULL on error | | * @return handle to the host, NULL on error | |
| */ | | */ | |
| struct GNUNET_TESTBED_Host * | | struct GNUNET_TESTBED_Host * | |
| GNUNET_TESTBED_host_create (const char *hostname, | | GNUNET_TESTBED_host_create (const char *hostname, | |
| const char *username, | | const char *username, | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 124 | |
| /** | | /** | |
| * Destroy a host handle. Must only be called once everything | | * Destroy a host handle. Must only be called once everything | |
| * running on that host has been stopped. | | * running on that host has been stopped. | |
| * | | * | |
| * @param host handle to destroy | | * @param host handle to destroy | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host); | | GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host); | |
| | | | |
| /** | | /** | |
|
| | | * The handle for whether a host is habitable or not | |
| | | */ | |
| | | struct GNUNET_TESTBED_HostHabitableCheckHandle; | |
| | | | |
| | | /** | |
| | | * Callbacks of this type are called by GNUNET_TESTBED_is_host_habitable to | |
| | | * inform whether the given host is habitable or not. The Handle returned b | |
| | | y | |
| | | * GNUNET_TESTBED_is_host_habitable() is invalid after this callback is cal | |
| | | led | |
| | | * | |
| | | * @param cls the closure given to GNUNET_TESTBED_is_host_habitable() | |
| | | * @param host the host whose status is being reported; will be NULL if the | |
| | | host | |
| | | * given to GNUNET_TESTBED_is_host_habitable() is NULL | |
| | | * @param status GNUNET_YES if it is habitable; GNUNET_NO if not | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_HostHabitableCallback) (void *cls, | |
| | | const struct | |
| | | GNUNET_TESTBED_Host | |
| | | *host, | |
| | | int status); | |
| | | | |
| | | /** | |
| * Checks whether a host can be used to start testbed service | | * Checks whether a host can be used to start testbed service | |
| * | | * | |
| * @param host the host to check | | * @param host the host to check | |
|
| * @param config the configuration handle to lookup the path of the testbed | | * @param config the configuration handle to lookup the path of the testbed | |
| helper | | * helper | |
| * @return GNUNET_YES if testbed service can be started on the given host | | * @param cb the callback to call to inform about habitability of the given | |
| * remotely; GNUNET_NO if not | | host | |
| | | * @param cb_cls the closure for the callback | |
| | | * @return NULL upon any error or a handle which can be passed to | |
| | | * GNUNET_TESTBED_is_host_habitable_cancel() | |
| */ | | */ | |
|
| int | | struct GNUNET_TESTBED_HostHabitableCheckHandle * | |
| GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | | GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | |
|
| const struct GNUNET_CONFIGURATION_Handle | | const struct GNUNET_CONFIGURATION_Handle | |
| *config); | | *config, | |
| | | GNUNET_TESTBED_HostHabitableCallback cb, | |
| | | void *cb_cls); | |
| | | | |
| | | /** | |
| | | * Function to cancel a request started using GNUNET_TESTBED_is_host_habita | |
| | | ble() | |
| | | * | |
| | | * @param struct handle the habitability check handle | |
| | | */ | |
| | | void | |
| | | GNUNET_TESTBED_is_host_habitable_cancel (struct | |
| | | GNUNET_TESTBED_HostHabitableCheckH | |
| | | andle | |
| | | *handle); | |
| | | | |
| /** | | /** | |
| * Obtain the host's hostname. | | * Obtain the host's hostname. | |
| * | | * | |
| * @param host handle to the host, NULL means 'localhost' | | * @param host handle to the host, NULL means 'localhost' | |
| * @return hostname of the host | | * @return hostname of the host | |
| */ | | */ | |
| const char * | | const char * | |
| GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host); | | GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host); | |
| | | | |
| | | | |
| skipping to change at line 391 | | skipping to change at line 423 | |
| * @param cfg the configuration with which the controller has been started; | | * @param cfg the configuration with which the controller has been started; | |
| * NULL if status is not GNUNET_OK | | * NULL if status is not GNUNET_OK | |
| * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if
not, | | * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if
not, | |
| * GNUNET_TESTBED_controller_stop() shouldn't be called in this ca
se | | * GNUNET_TESTBED_controller_stop() shouldn't be called in this ca
se | |
| */ | | */ | |
| typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls, | | typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls, | |
| const struct GNUNET
_CONFIGURATION_Handle *cfg, | | const struct GNUNET
_CONFIGURATION_Handle *cfg, | |
| int status); | | int status); | |
| | | | |
| /** | | /** | |
|
| * Starts a controller process at the host. | | * Starts a controller process at the given host. | |
| * | | * | |
|
| * @param controller_ip the ip address of the controller. Will be set as TR | | * @param trusted_ip the ip address of the controller which will be set as | |
| USTED | | TRUSTED | |
| * host when starting testbed controller at host | | * HOST(all connections form this ip are permitted by the testbed) | |
| | | when | |
| | | * starting testbed controller at host. This can either be a singl | |
| | | e ip | |
| | | * address or a network address in CIDR notation. | |
| * @param host the host where the controller has to be started; NULL for | | * @param host the host where the controller has to be started; NULL for | |
| * localhost | | * localhost | |
| * @param cfg template configuration to use for the remote controller; the | | * @param cfg template configuration to use for the remote controller; the | |
| * remote controller will be started with a slightly modified | | * remote controller will be started with a slightly modified | |
| * configuration (port numbers, unix domain sockets and service ho
me | | * configuration (port numbers, unix domain sockets and service ho
me | |
| * values are changed as per TESTING library on the remote host) | | * values are changed as per TESTING library on the remote host) | |
| * @param cb function called when the controller is successfully started or | | * @param cb function called when the controller is successfully started or | |
| * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be | | * dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be | |
| * called if cb is called with GNUNET_SYSERR as status. Will never
be | | * called if cb is called with GNUNET_SYSERR as status. Will never
be | |
| * called in the same task as 'GNUNET_TESTBED_controller_start' | | * called in the same task as 'GNUNET_TESTBED_controller_start' | |
| * (synchronous errors will be signalled by returning NULL). This | | * (synchronous errors will be signalled by returning NULL). This | |
| * parameter cannot be NULL. | | * parameter cannot be NULL. | |
| * @param cls closure for above callbacks | | * @param cls closure for above callbacks | |
| * @return the controller process handle, NULL on errors | | * @return the controller process handle, NULL on errors | |
| */ | | */ | |
| struct GNUNET_TESTBED_ControllerProc * | | struct GNUNET_TESTBED_ControllerProc * | |
|
| GNUNET_TESTBED_controller_start (const char *controller_ip, | | GNUNET_TESTBED_controller_start (const char *trusted_ip, | |
| struct GNUNET_TESTBED_Host *host, | | struct GNUNET_TESTBED_Host *host, | |
| const struct GNUNET_CONFIGURATION_Handle *
cfg, | | const struct GNUNET_CONFIGURATION_Handle *
cfg, | |
| GNUNET_TESTBED_ControllerStatusCallback cb
, | | GNUNET_TESTBED_ControllerStatusCallback cb
, | |
| void *cls); | | void *cls); | |
| | | | |
| /** | | /** | |
| * Stop the controller process (also will terminate all peers and controlle
rs | | * Stop the controller process (also will terminate all peers and controlle
rs | |
| * dependent on this controller). This function blocks until the testbed h
as | | * dependent on this controller). This function blocks until the testbed h
as | |
| * been fully terminated (!). The controller status cb from | | * been fully terminated (!). The controller status cb from | |
| * GNUNET_TESTBED_controller_start() will not be called. | | * GNUNET_TESTBED_controller_start() will not be called. | |
| | | | |
| skipping to change at line 495 | | skipping to change at line 529 | |
| /** | | /** | |
| * Callback which will be called to after a host registration succeeded or
failed | | * Callback which will be called to after a host registration succeeded or
failed | |
| * | | * | |
| * @param cls the closure | | * @param cls the closure | |
| * @param emsg the error message; NULL if host registration is successful | | * @param emsg the error message; NULL if host registration is successful | |
| */ | | */ | |
| typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, | | typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, | |
| const char *ems
g); | | const char *ems
g); | |
| | | | |
| /** | | /** | |
|
| * Register a host with the controller | | * Register a host with the controller. This makes the controller aware of | |
| | | the | |
| | | * host. A host should be registered at the controller before starting a | |
| | | * sub-controller on that host using GNUNET_TESTBED_controller_link(). | |
| * | | * | |
| * @param controller the controller handle | | * @param controller the controller handle | |
| * @param host the host to register | | * @param host the host to register | |
| * @param cc the completion callback to call to inform the status of | | * @param cc the completion callback to call to inform the status of | |
| * registration. After calling this callback the registration hand
le | | * registration. After calling this callback the registration hand
le | |
| * will be invalid. Cannot be NULL | | * will be invalid. Cannot be NULL | |
| * @param cc_cls the closure for the cc | | * @param cc_cls the closure for the cc | |
| * @return handle to the host registration which can be used to cancel the | | * @return handle to the host registration which can be used to cancel the | |
| * registration; NULL if another registration handle is present a
nd | | * registration; NULL if another registration handle is present a
nd | |
| * is not cancelled | | * is not cancelled | |
| | | | |
| skipping to change at line 662 | | skipping to change at line 698 | |
| * configure the peer; use "GNUNET_TESTBED_peer_start" and | | * configure the peer; use "GNUNET_TESTBED_peer_start" and | |
| * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's | | * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's | |
| * processes. | | * processes. | |
| * | | * | |
| * Note that the given configuration will be adjusted by the | | * Note that the given configuration will be adjusted by the | |
| * controller to avoid port/path conflicts with other peers. | | * controller to avoid port/path conflicts with other peers. | |
| * The "final" configuration can be obtained using | | * The "final" configuration can be obtained using | |
| * 'GNUNET_TESTBED_peer_get_information'. | | * 'GNUNET_TESTBED_peer_get_information'. | |
| * | | * | |
| * @param controller controller process to use | | * @param controller controller process to use | |
|
| * @param host host to run the peer on | | * @param host host to run the peer on; cannot be NULL | |
| * @param cfg Template configuration to use for the peer. Should exist unti
l | | * @param cfg Template configuration to use for the peer. Should exist unti
l | |
| * operation is cancelled or GNUNET_TESTBED_operation_done() is ca
lled | | * operation is cancelled or GNUNET_TESTBED_operation_done() is ca
lled | |
| * @param cb the callback to call when the peer has been created | | * @param cb the callback to call when the peer has been created | |
| * @param cls the closure to the above callback | | * @param cls the closure to the above callback | |
| * @return the operation handle | | * @return the operation handle | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | | GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | |
| struct GNUNET_TESTBED_Host *host, | | struct GNUNET_TESTBED_Host *host, | |
| const struct GNUNET_CONFIGURATION_Handle *cfg, | | const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | | |
| skipping to change at line 918 | | skipping to change at line 954 | |
| GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | |
| | | | |
| /** | | /** | |
| * Certain percentage of peers are unable to communicate directly | | * Certain percentage of peers are unable to communicate directly | |
| * replicating NAT conditions. Followed by the fraction of | | * replicating NAT conditions. Followed by the fraction of | |
| * NAT'ed peers (float). | | * NAT'ed peers (float). | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_INTERNAT, | | GNUNET_TESTBED_TOPOLOGY_INTERNAT, | |
| | | | |
| /** | | /** | |
|
| * Scale free topology. FIXME: options? | | * Scale free topology. No options. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, | | GNUNET_TESTBED_TOPOLOGY_SCALE_FREE, | |
| | | | |
| /** | | /** | |
| * Straight line topology. No options. | | * Straight line topology. No options. | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_LINE, | | GNUNET_TESTBED_TOPOLOGY_LINE, | |
| | | | |
| /** | | /** | |
|
| * All peers are disconnected. No options. | | * Read a topology from a given file. Followed by the name of the file (
const char *). | |
| */ | | */ | |
|
| GNUNET_TESTBED_TOPOLOGY_NONE, | | GNUNET_TESTBED_TOPOLOGY_FROM_FILE, | |
| | | | |
| /** | | /** | |
|
| * Read a topology from a given file. Followed by the name of the file (
const char *). | | * All peers are disconnected. No options. | |
| */ | | */ | |
|
| GNUNET_TESTBED_TOPOLOGY_FROM_FILE, | | GNUNET_TESTBED_TOPOLOGY_NONE, | |
| | | | |
| /** | | /** | |
| * The options should always end with this | | * The options should always end with this | |
| */ | | */ | |
| GNUNET_TESTBED_TOPOLOGY_OPTION_END, | | GNUNET_TESTBED_TOPOLOGY_OPTION_END, | |
| | | | |
| /* The following are not topologies but influence how the topology has to
be | | /* The following are not topologies but influence how the topology has to
be | |
| setup. These options should follow the topology specific options (if | | setup. These options should follow the topology specific options (if | |
| required by the chosen topology). Note that these should be given befo
re | | required by the chosen topology). Note that these should be given befo
re | |
| GNUNET_TESTBED_TOPOLOGY_OPTION_END */ | | GNUNET_TESTBED_TOPOLOGY_OPTION_END */ | |
| | | | |
| skipping to change at line 1019 | | skipping to change at line 1055 | |
| struct GNUNET_TESTBED_Peer *p2); | | struct GNUNET_TESTBED_Peer *p2); | |
| | | | |
| /** | | /** | |
| * All peers must have been started before calling this function. | | * All peers must have been started before calling this function. | |
| * This function then connects the given peers in the P2P overlay | | * This function then connects the given peers in the P2P overlay | |
| * using the given topology. | | * using the given topology. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
|
| | | * @param max_connections the maximums number of overlay connections that w | |
| | | ill | |
| | | * be made to achieve the given topology | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param va topology-specific options | | * @param va topology-specific options | |
| * @return handle to the operation, NULL if connecting these | | * @return handle to the operation, NULL if connecting these | |
| * peers is fundamentally not possible at this time (peers | | * peers is fundamentally not possible at this time (peers | |
| * not running or underlay disallows) or if num_peers is less than
2 | | * not running or underlay disallows) or if num_peers is less than
2 | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | | GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer **
peers, | | struct GNUNET_TESTBED_Peer **
peers, | |
|
| | | unsigned int *max_connections
, | |
| enum GNUNET_TESTBED_TopologyO
ption topo, | | enum GNUNET_TESTBED_TopologyO
ption topo, | |
| va_list va); | | va_list va); | |
| | | | |
| /** | | /** | |
| * All peers must have been started before calling this function. | | * All peers must have been started before calling this function. | |
| * This function then connects the given peers in the P2P overlay | | * This function then connects the given peers in the P2P overlay | |
| * using the given topology. | | * using the given topology. | |
| * | | * | |
| * @param op_cls closure argument to give with the operation event | | * @param op_cls closure argument to give with the operation event | |
| * @param num_peers number of peers in 'peers' | | * @param num_peers number of peers in 'peers' | |
| * @param peers array of 'num_peers' with the peers to configure | | * @param peers array of 'num_peers' with the peers to configure | |
|
| | | * @param max_connections the maximums number of overlay connections that w | |
| | | ill | |
| | | * be made to achieve the given topology | |
| * @param topo desired underlay topology to use | | * @param topo desired underlay topology to use | |
| * @param ... topology-specific options | | * @param ... topology-specific options | |
| * @return handle to the operation, NULL if connecting these | | * @return handle to the operation, NULL if connecting these | |
| * peers is fundamentally not possible at this time (peers | | * peers is fundamentally not possible at this time (peers | |
| * not running or underlay disallows) or if num_peers is less than
2 | | * not running or underlay disallows) or if num_peers is less than
2 | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_overlay_configure_topology (void *op_cls, | | GNUNET_TESTBED_overlay_configure_topology (void *op_cls, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer **pee
rs, | | struct GNUNET_TESTBED_Peer **pee
rs, | |
|
| | | unsigned int *max_connections, | |
| enum GNUNET_TESTBED_TopologyOpti
on topo, | | enum GNUNET_TESTBED_TopologyOpti
on topo, | |
| ...); | | ...); | |
| | | | |
| /** | | /** | |
| * Ask the testbed controller to write the current overlay topology to | | * Ask the testbed controller to write the current overlay topology to | |
| * a file. Naturally, the file will only contain a snapshot as the | | * a file. Naturally, the file will only contain a snapshot as the | |
| * topology may evolve all the time. | | * topology may evolve all the time. | |
| * FIXME: needs continuation!? | | * FIXME: needs continuation!? | |
| * | | * | |
| * @param controller overlay controller to inspect | | * @param controller overlay controller to inspect | |
| | | | |
| skipping to change at line 1164 | | skipping to change at line 1206 | |
| * If the operation is generated from GNUNET_TESTBED_service_connect() then | | * If the operation is generated from GNUNET_TESTBED_service_connect() then | |
| * calling this function on such as operation calls the disconnect adapter
if | | * calling this function on such as operation calls the disconnect adapter
if | |
| * the connect adapter was ever called. | | * the connect adapter was ever called. | |
| * | | * | |
| * @param operation operation to signal completion or cancellation | | * @param operation operation to signal completion or cancellation | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); | | GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation); | |
| | | | |
| /** | | /** | |
|
| * Configure and run a testbed using the given | | | |
| * master controller on 'num_hosts' starting | | | |
| * 'num_peers' using the given peer configuration. | | | |
| * | | | |
| * @param controller master controller for the testbed | | | |
| * (must not be destroyed until after the | | | |
| * testbed is destroyed). | | | |
| * @param num_hosts number of hosts in 'hosts', 0 to only | | | |
| * use 'localhost' | | | |
| * @param hosts list of hosts to use for the testbed | | | |
| * @param num_peers number of peers to start | | | |
| * @param peer_cfg peer configuration template to use | | | |
| * @param underlay_topology underlay topology to create | | | |
| * @param va topology-specific options | | | |
| * @return handle to the testbed | | | |
| */ | | | |
| struct GNUNET_TESTBED_Testbed * | | | |
| GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, | | | |
| unsigned int num_hosts, | | | |
| struct GNUNET_TESTBED_Host **hosts, | | | |
| unsigned int num_peers, | | | |
| const struct GNUNET_CONFIGURATION_Handle *peer_cf | | | |
| g, | | | |
| enum GNUNET_TESTBED_TopologyOption underlay_topol | | | |
| ogy, | | | |
| va_list va); | | | |
| | | | |
| /** | | | |
| * Configure and run a testbed using the given | | | |
| * master controller on 'num_hosts' starting | | | |
| * 'num_peers' using the given peer configuration. | | | |
| * | | | |
| * @param controller master controller for the testbed | | | |
| * (must not be destroyed until after the | | | |
| * testbed is destroyed). | | | |
| * @param num_hosts number of hosts in 'hosts', 0 to only | | | |
| * use 'localhost' | | | |
| * @param hosts list of hosts to use for the testbed | | | |
| * @param num_peers number of peers to start | | | |
| * @param peer_cfg peer configuration template to use | | | |
| * @param underlay_topology underlay topology to create | | | |
| * @param ... topology-specific options | | | |
| */ | | | |
| struct GNUNET_TESTBED_Testbed * | | | |
| GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, | | | |
| unsigned int num_hosts, | | | |
| struct GNUNET_TESTBED_Host **hosts, | | | |
| unsigned int num_peers, | | | |
| const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | | | |
| enum GNUNET_TESTBED_TopologyOption underlay_topology | | | |
| , | | | |
| ...); | | | |
| | | | |
| /** | | | |
| * Destroy a testbed. Stops all running peers and then | | | |
| * destroys all peers. Does NOT destroy the master controller. | | | |
| * | | | |
| * @param testbed testbed to destroy | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed); | | | |
| | | | |
| /** | | | |
| * Callback function to process statistic values from all peers. | | * Callback function to process statistic values from all peers. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param peer the peer the statistic belong to | | * @param peer the peer the statistic belong to | |
| * @param subsystem name of subsystem that created the statistic | | * @param subsystem name of subsystem that created the statistic | |
| * @param name the name of the datum | | * @param name the name of the datum | |
| * @param value the current value | | * @param value the current value | |
| * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if
not | | * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if
not | |
| * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | |
| */ | | */ | |
| | | | |
| skipping to change at line 1260 | | skipping to change at line 1242 | |
| * @return operation handle to cancel the operation | | * @return operation handle to cancel the operation | |
| */ | | */ | |
| struct GNUNET_TESTBED_Operation * | | struct GNUNET_TESTBED_Operation * | |
| GNUNET_TESTBED_get_statistics (unsigned int num_peers, | | GNUNET_TESTBED_get_statistics (unsigned int num_peers, | |
| struct GNUNET_TESTBED_Peer **peers, | | struct GNUNET_TESTBED_Peer **peers, | |
| GNUNET_TESTBED_StatisticsIterator proc, | | GNUNET_TESTBED_StatisticsIterator proc, | |
| GNUNET_TESTBED_OperationCompletionCallback c
ont, | | GNUNET_TESTBED_OperationCompletionCallback c
ont, | |
| void *cls); | | void *cls); | |
| | | | |
| /** | | /** | |
|
| | | * Signature of a main function for a testcase. | |
| | | * | |
| | | * @param cls closure | |
| | | * @param num_peers number of peers in 'peers' | |
| | | * @param peers handle to peers run in the testbed | |
| | | */ | |
| | | typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, | |
| | | unsigned int num_peers, | |
| | | struct GNUNET_TESTBED_Peer **peer | |
| | | s); | |
| | | | |
| | | /** | |
| * Convenience method for running a testbed with | | * Convenience method for running a testbed with | |
| * a single call. Underlay and overlay topology | | * a single call. Underlay and overlay topology | |
| * are configured using the "UNDERLAY" and "OVERLAY" | | * are configured using the "UNDERLAY" and "OVERLAY" | |
| * options in the "[testbed]" section of the configuration\ | | * options in the "[testbed]" section of the configuration\ | |
| * (with possible options given in "UNDERLAY_XXX" and/or | | * (with possible options given in "UNDERLAY_XXX" and/or | |
| * "OVERLAY_XXX"). | | * "OVERLAY_XXX"). | |
| * | | * | |
| * The testbed is to be terminated using a call to | | * The testbed is to be terminated using a call to | |
| * "GNUNET_SCHEDULER_shutdown". | | * "GNUNET_SCHEDULER_shutdown". | |
| * | | * | |
| | | | |
| skipping to change at line 1284 | | skipping to change at line 1277 | |
| * cfg?; should be greater than 0 | | * cfg?; should be greater than 0 | |
| * @param event_mask bit mask with set of events to call 'cc' for; | | * @param event_mask bit mask with set of events to call 'cc' for; | |
| * or-ed values of "1LL" shifted by the | | * or-ed values of "1LL" shifted by the | |
| * respective 'enum GNUNET_TESTBED_EventType' | | * respective 'enum GNUNET_TESTBED_EventType' | |
| * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | |
| * @param cc controller callback to invoke on events; This callback is call
ed | | * @param cc controller callback to invoke on events; This callback is call
ed | |
| * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't | | * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't | |
| * set in the event_mask as this is the only way get access to the | | * set in the event_mask as this is the only way get access to the | |
| * handle of each peer | | * handle of each peer | |
| * @param cc_cls closure for cc | | * @param cc_cls closure for cc | |
|
| * @param master task to run once the testbed is ready | | * @param test_master this callback will be called once the test is ready | |
| * @param master_cls closure for 'task'. | | * @param test_master_cls closure for 'test_master'. | |
| */ | | */ | |
| void | | void | |
| GNUNET_TESTBED_run (const char *host_filename, | | GNUNET_TESTBED_run (const char *host_filename, | |
| const struct GNUNET_CONFIGURATION_Handle *cfg, | | const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| uint64_t event_mask, | | uint64_t event_mask, | |
| GNUNET_TESTBED_ControllerCallback cc, | | GNUNET_TESTBED_ControllerCallback cc, | |
| void *cc_cls, | | void *cc_cls, | |
|
| GNUNET_SCHEDULER_Task master, | | GNUNET_TESTBED_TestMaster test_master, | |
| void *master_cls); | | void *test_master_cls); | |
| | | | |
| /** | | | |
| * Signature of a main function for a testcase. | | | |
| * | | | |
| * @param cls closure | | | |
| * @param num_peers number of peers in 'peers' | | | |
| * @param peers handle to peers run in the testbed | | | |
| */ | | | |
| typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, | | | |
| unsigned int num_peers, | | | |
| struct GNUNET_TESTBED_Peer **peer | | | |
| s); | | | |
| | | | |
| /** | | /** | |
| * Convenience method for running a "simple" test on the local system | | * Convenience method for running a "simple" test on the local system | |
| * with a single call from 'main'. Underlay and overlay topology are | | * with a single call from 'main'. Underlay and overlay topology are | |
| * configured using the "UNDERLAY" and "OVERLAY" options in the | | * configured using the "UNDERLAY" and "OVERLAY" options in the | |
| * "[testbed]" section of the configuration (with possible options | | * "[testbed]" section of the configuration (with possible options | |
| * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). | | * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). | |
| * | | * | |
| * The test is to be terminated using a call to | | * The test is to be terminated using a call to | |
| * "GNUNET_SCHEDULER_shutdown". If starting the test fails, | | * "GNUNET_SCHEDULER_shutdown". If starting the test fails, | |
| | | | |
| skipping to change at line 1337 | | skipping to change at line 1319 | |
| * @param num_peers number of peers to start; should be greter than 0 | | * @param num_peers number of peers to start; should be greter than 0 | |
| * @param event_mask bit mask with set of events to call 'cc' for; | | * @param event_mask bit mask with set of events to call 'cc' for; | |
| * or-ed values of "1LL" shifted by the | | * or-ed values of "1LL" shifted by the | |
| * respective 'enum GNUNET_TESTBED_EventType' | | * respective 'enum GNUNET_TESTBED_EventType' | |
| * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | |
| * @param cc controller callback to invoke on events; This callback is call
ed | | * @param cc controller callback to invoke on events; This callback is call
ed | |
| * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't | | * for all peer start events even if GNUNET_TESTBED_ET_PEER_START is
n't | |
| * set in the event_mask as this is the only way get access to the | | * set in the event_mask as this is the only way get access to the | |
| * handle of each peer | | * handle of each peer | |
| * @param cc_cls closure for cc | | * @param cc_cls closure for cc | |
|
| * @param test_master task to run once the test is ready | | * @param test_master this callback will be called once the test is ready | |
| * @param test_master_cls closure for 'task'. | | * @param test_master_cls closure for 'test_master'. | |
| | | * @param GNUNET_SYSERR on error, GNUNET_OK on success | |
| */ | | */ | |
|
| void | | int | |
| GNUNET_TESTBED_test_run (const char *testname, | | GNUNET_TESTBED_test_run (const char *testname, | |
| const char *cfg_filename, | | const char *cfg_filename, | |
| unsigned int num_peers, | | unsigned int num_peers, | |
| uint64_t event_mask, | | uint64_t event_mask, | |
| GNUNET_TESTBED_ControllerCallback cc, | | GNUNET_TESTBED_ControllerCallback cc, | |
| void *cc_cls, | | void *cc_cls, | |
| GNUNET_TESTBED_TestMaster test_master, | | GNUNET_TESTBED_TestMaster test_master, | |
| void *test_master_cls); | | void *test_master_cls); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| | | | |
End of changes. 26 change blocks. |
| 107 lines changed or deleted | | 96 lines changed or added | |
|
| gnunet_testing_lib.h | | gnunet_testing_lib.h | |
| /* | | /* | |
| This file is part of GNUnet | | This file is part of GNUnet | |
|
| (C) 2008, 2009 Christian Grothoff (and other contributing authors) | | (C) 2008, 2009, 2012 Christian Grothoff (and other contributing autho
rs) | |
| | | | |
| GNUnet is free software; you can redistribute it and/or modify | | GNUnet is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published | | it under the terms of the GNU General Public License as published | |
| by the Free Software Foundation; either version 3, or (at your | | by the Free Software Foundation; either version 3, or (at your | |
| option) any later version. | | option) any later version. | |
| | | | |
| GNUnet is distributed in the hope that it will be useful, but | | GNUnet is distributed in the hope that it will be useful, but | |
| WITHOUT ANY WARRANTY; without even the implied warranty of | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| General Public License for more details. | | General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with GNUnet; see the file COPYING. If not, write to the | | along with GNUnet; see the file COPYING. If not, write to the | |
| Free Software Foundation, Inc., 59 Temple Place - Suite 330, | | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| Boston, MA 02111-1307, USA. | | Boston, MA 02111-1307, USA. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file include/gnunet_testing_lib.h | | * @file include/gnunet_testing_lib.h | |
|
| * @brief convenience API for writing testcases for GNUnet | | * @brief convenience API for writing testcases for GNUnet; | |
| * Many testcases need to start and stop gnunetd, | | * can start/stop one or more peers on a system; | |
| * and this library is supposed to make that easier | | * testing is responsible for managing private keys, | |
| * for TESTCASES. Normal programs should always | | * ports and paths; it is a low-level library that | |
| * use functions from gnunet_{util,arm}_lib.h. This API is | | * does not support higher-level functions such as | |
| * ONLY for writing testcases! | | * P2P connection, topology management or distributed | |
| | | * testbed maintenance (those are in gnunet_testbed_service.h) | |
| * @author Christian Grothoff | | * @author Christian Grothoff | |
| */ | | */ | |
| | | | |
| #ifndef GNUNET_TESTING_LIB_H | | #ifndef GNUNET_TESTING_LIB_H | |
| #define GNUNET_TESTING_LIB_H | | #define GNUNET_TESTING_LIB_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
| #include "gnunet_statistics_service.h" | | #include "gnunet_statistics_service.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| #define HOSTKEYFILESIZE 914 | | #define GNUNET_TESTING_HOSTKEYFILESIZE 914 | |
| | | | |
| /** | | /** | |
|
| * Handle for a GNUnet daemon (technically a set of | | * Handle for a system on which GNUnet peers are executed; | |
| * daemons; the handle is really for the master ARM | | * a system is used for reserving unique paths and ports. | |
| * daemon) started by the testing library. | | | |
| */ | | */ | |
|
| struct GNUNET_TESTING_Daemon; | | struct GNUNET_TESTING_System; | |
| | | | |
| /** | | /** | |
|
| * Linked list of hostnames and ports to use for starting daemons. | | * Handle for a GNUnet peer controlled by testing. | |
| */ | | */ | |
|
| struct GNUNET_TESTING_Host | | struct GNUNET_TESTING_Peer; | |
| { | | | |
| /** | | | |
| * Pointer to next item in the list. | | | |
| */ | | | |
| struct GNUNET_TESTING_Host *next; | | | |
| | | | |
| /** | | | |
| * Hostname to connect to. | | | |
| */ | | | |
| char *hostname; | | | |
| | | | |
| /** | | | |
| * Username to use when connecting (may be null). | | | |
| */ | | | |
| char *username; | | | |
| | | | |
| /** | | | |
| * Port to use for SSH connection (used for ssh | | | |
| * connection forwarding, 0 to let ssh decide) | | | |
| */ | | | |
| uint16_t port; | | | |
| }; | | | |
| | | | |
| /** | | /** | |
|
| * Prototype of a function that will be called whenever | | * Create a system handle. There must only be one system handle per operat | |
| * a daemon was started by the testing library. | | ing | |
| | | * system. Uses a default range for allowed ports. Ports are still tested | |
| | | for | |
| | | * availability. | |
| * | | * | |
|
| * @param cls closure | | * @param testdir only the directory name without any path. This is used fo | |
| * @param id identifier for the daemon, NULL on error | | r all | |
| * @param d handle for the daemon | | * service homes; the directory will be created in a temporary loc | |
| * @param emsg error message (NULL on success) | | ation | |
| */ | | * depending on the underlying OS | |
| typedef void (*GNUNET_TESTING_NotifyHostkeyCreated) (void *cls, | | * @param trusted_ip the ip address which will be set as TRUSTED HOST in al | |
| const struct | | l | |
| GNUNET_PeerIdentity * | | * service configurations generated to allow control connections f | |
| id, | | rom | |
| struct | | * this ip. This can either be a single ip address or a network ad | |
| GNUNET_TESTING_Daemon | | dress | |
| * d, | | * in CIDR notation. | |
| const char *emsg); | | * @param hostname the hostname of the system we are using for testing; NUL | |
| | | L for | |
| /** | | * localhost | |
| * Prototype of a function that will be called whenever | | * @return handle to this system, NULL on error | |
| * a daemon was started by the testing library. | | | |
| * | | | |
| * @param cls closure | | | |
| * @param id identifier for the daemon, NULL on error | | | |
| * @param cfg configuration used by this daemon | | | |
| * @param d handle for the daemon | | | |
| * @param emsg error message (NULL on success) | | | |
| */ | | */ | |
|
| typedef void (*GNUNET_TESTING_NotifyDaemonRunning) (void *cls, | | struct GNUNET_TESTING_System * | |
| const struct | | GNUNET_TESTING_system_create (const char *testdir, | |
| GNUNET_PeerIdentity * i | | const char *trusted_ip, | |
| d, | | const char *hostname); | |
| const struct | | | |
| GNUNET_CONFIGURATION_Ha | | | |
| ndle | | | |
| * cfg, | | | |
| struct GNUNET_TESTING_D | | | |
| aemon | | | |
| * d, const char *emsg); | | | |
| | | | |
| /** | | | |
| * Handle to an entire testbed of GNUnet peers. | | | |
| */ | | | |
| struct GNUNET_TESTING_Testbed; | | | |
| | | | |
| /** | | | |
| * Phases of starting GNUnet on a system. | | | |
| */ | | | |
| enum GNUNET_TESTING_StartPhase | | | |
| { | | | |
| /** | | | |
| * Copy the configuration file to the target system. | | | |
| */ | | | |
| SP_COPYING, | | | |
| | | | |
| /** | | | |
| * Configuration file has been copied, generate hostkey. | | | |
| */ | | | |
| SP_COPIED, | | | |
| | | | |
| /** | | | |
| * Create the hostkey for the peer. | | | |
| */ | | | |
| SP_HOSTKEY_CREATE, | | | |
| | | | |
| /** | | | |
| * Hostkey generated, wait for topology to be finished. | | | |
| */ | | | |
| SP_HOSTKEY_CREATED, | | | |
| | | | |
| /** | | | |
| * Topology has been created, now start ARM. | | | |
| */ | | | |
| SP_TOPOLOGY_SETUP, | | | |
| | | | |
| /** | | | |
| * ARM has been started, check that it has properly daemonized and | | | |
| * then try to connect to the CORE service (which should be | | | |
| * auto-started by ARM). | | | |
| */ | | | |
| SP_START_ARMING, | | | |
| | | | |
| /** | | | |
| * We're waiting for CORE to start. | | | |
| */ | | | |
| SP_START_CORE, | | | |
| | | | |
| /** | | | |
| * CORE is up, now make sure we get the HELLO for this peer. | | | |
| */ | | | |
| SP_GET_HELLO, | | | |
| | | | |
| /** | | | |
| * Core has notified us that we've established a connection to the servic | | | |
| e. | | | |
| * The main FSM halts here and waits to be moved to UPDATE or CLEANUP. | | | |
| */ | | | |
| SP_START_DONE, | | | |
| | | | |
| /** | | | |
| * We've been asked to terminate the instance and are now waiting for | | | |
| * the remote command to stop the gnunet-arm process and delete temporary | | | |
| * files. | | | |
| */ | | | |
| SP_SHUTDOWN_START, | | | |
| | | | |
| /** | | | |
| * We should shutdown a *single* service via gnunet-arm. Call the dead_c | | | |
| b | | | |
| * upon notification from gnunet-arm that the service has been stopped. | | | |
| */ | | | |
| SP_SERVICE_SHUTDOWN_START, | | | |
| | | | |
| /** | | | |
| * We should start a *single* service via gnunet-arm. Call the daemon cb | | | |
| * upon notification from gnunet-arm that the service has been started. | | | |
| */ | | | |
| SP_SERVICE_START, | | | |
| | | | |
| /** | | | |
| * We've received a configuration update and are currently waiting for | | | |
| * the copy process for the update to complete. Once it is, we will | | | |
| * return to "SP_START_DONE" (and rely on ARM to restart all affected | | | |
| * services). | | | |
| */ | | | |
| SP_CONFIG_UPDATE | | | |
| }; | | | |
| | | | |
| /** | | /** | |
|
| * Prototype of a function that will be called when a | | * Create a system handle. There must only be one system | |
| * particular operation was completed the testing library. | | * handle per operating system. Use this function directly | |
| | | * if multiple system objects are created for the same host | |
| | | * (only really useful when testing --- or to make the port | |
| | | * range configureable). | |
| * | | * | |
|
| * @param cls closure | | * @param testdir only the directory name without any path. This is used fo | |
| * @param emsg NULL on success | | r | |
| | | * all service homes; the directory will be created in a temporary | |
| | | * location depending on the underlying OS | |
| | | * @param trusted_ip the ip address which will be set as TRUSTED HOST in al | |
| | | l | |
| | | * service configurations generated to allow control connections f | |
| | | rom | |
| | | * this ip. This can either be a single ip address or a network ad | |
| | | dress | |
| | | * in CIDR notation. | |
| | | * @param controller hostname of the controlling host, | |
| | | * service configurations are modified to allow | |
| | | * control connections from this host; can be NULL | |
| | | * @param hostname the hostname of the system we are using for testing; NUL | |
| | | L for | |
| | | * localhost | |
| | | * @param lowport lowest port number this system is allowed to allocate (in | |
| | | clusive) | |
| | | * @param highport highest port number this system is allowed to allocate ( | |
| | | exclusive) | |
| | | * @return handle to this system, NULL on error | |
| */ | | */ | |
|
| typedef void (*GNUNET_TESTING_NotifyCompletion) (void *cls, const char *ems | | struct GNUNET_TESTING_System * | |
| g); | | GNUNET_TESTING_system_create_with_portrange (const char *testdir, | |
| | | const char *trusted_ip, | |
| | | const char *hostname, | |
| | | uint16_t lowport, | |
| | | uint16_t highport); | |
| | | | |
| /** | | /** | |
|
| * Prototype of a function that will be called with the | | * Free system resources. | |
| * number of connections created for a particular topology. | | | |
| * | | * | |
|
| * @param cls closure | | * @param system system to be freed | |
| * @param num_connections the number of connections created | | * @param remove_paths should the 'testdir' and all subdirectories | |
| */ | | * be removed (clean up on shutdown)? | |
| typedef void (*GNUNET_TESTING_NotifyConnections) (void *cls, | | | |
| unsigned int num_connecti | | | |
| ons); | | | |
| | | | |
| /** | | | |
| * Handle for a GNUnet daemon (technically a set of | | | |
| * daemons; the handle is really for the master ARM | | | |
| * daemon) started by the testing library. | | | |
| */ | | | |
| struct GNUNET_TESTING_Daemon | | | |
| { | | | |
| /** | | | |
| * Our configuration. | | | |
| */ | | | |
| struct GNUNET_CONFIGURATION_Handle *cfg; | | | |
| | | | |
| /** | | | |
| * At what time to give up starting the peer | | | |
| */ | | | |
| struct GNUNET_TIME_Absolute max_timeout; | | | |
| | | | |
| /** | | | |
| * Host to run GNUnet on. | | | |
| */ | | | |
| char *hostname; | | | |
| | | | |
| /** | | | |
| * Port to use for ssh, NULL to let system choose default. | | | |
| */ | | | |
| char *ssh_port_str; | | | |
| | | | |
| /** | | | |
| * Result of GNUNET_i2s of this peer, | | | |
| * for printing | | | |
| */ | | | |
| char *shortname; | | | |
| | | | |
| /** | | | |
| * Username we are using. | | | |
| */ | | | |
| char *username; | | | |
| | | | |
| /** | | | |
| * Name of the configuration file | | | |
| */ | | | |
| char *cfgfile; | | | |
| | | | |
| /** | | | |
| * Callback to inform initiator that the peer's | | | |
| * hostkey has been created. | | | |
| */ | | | |
| GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback; | | | |
| | | | |
| /** | | | |
| * Closure for hostkey creation callback. | | | |
| */ | | | |
| void *hostkey_cls; | | | |
| | | | |
| /** | | | |
| * Function to call when the peer is running. | | | |
| */ | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb; | | | |
| | | | |
| /** | | | |
| * Closure for cb. | | | |
| */ | | | |
| void *cb_cls; | | | |
| | | | |
| /** | | | |
| * Arguments from "daemon_stop" call. | | | |
| */ | | | |
| GNUNET_TESTING_NotifyCompletion dead_cb; | | | |
| | | | |
| /** | | | |
| * Closure for 'dead_cb'. | | | |
| */ | | | |
| void *dead_cb_cls; | | | |
| | | | |
| /** | | | |
| * Arguments from "daemon_stop" call. | | | |
| */ | | | |
| GNUNET_TESTING_NotifyCompletion update_cb; | | | |
| | | | |
| /** | | | |
| * Closure for 'update_cb'. | | | |
| */ | | | |
| void *update_cb_cls; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run gnunet-arm or SSH to start the peer. | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_start; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run gnunet-arm or SSH to stop the peer. | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_stop; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run gnunet-arm or SSH to manage services | | | |
| at the peer. | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_srv_start; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run gnunet-arm or SSH to manage services | | | |
| at the peer. | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_srv_stop; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run copy files | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_copying; | | | |
| | | | |
| /** | | | |
| * PID of the process we used to run gnunet-peerinfo. | | | |
| */ | | | |
| struct GNUNET_OS_Process *proc_arm_peerinfo; | | | |
| | | | |
| /** | | | |
| * Handle to the server. | | | |
| */ | | | |
| struct GNUNET_CORE_Handle *server; | | | |
| | | | |
| /** | | | |
| * Handle to the transport service of this peer | | | |
| */ | | | |
| struct GNUNET_TRANSPORT_Handle *th; | | | |
| | | | |
| /** | | | |
| * Handle for getting HELLOs from transport | | | |
| */ | | | |
| struct GNUNET_TRANSPORT_GetHelloHandle *ghh; | | | |
| | | | |
| /** | | | |
| * HELLO message for this peer | | | |
| */ | | | |
| struct GNUNET_HELLO_Message *hello; | | | |
| | | | |
| /** | | | |
| * Handle to a pipe for reading the hostkey. | | | |
| */ | | | |
| struct GNUNET_DISK_PipeHandle *pipe_stdout; | | | |
| | | | |
| /** | | | |
| * Currently, a single char * pointing to a service | | | |
| * that has been churned off. | | | |
| * | | | |
| * FIXME: make this a linked list of services that have been churned off! | | | |
| !! | | | |
| */ | | | |
| char *churned_services; | | | |
| | | | |
| /** | | | |
| * ID of the current task. | | | |
| */ | | | |
| GNUNET_SCHEDULER_TaskIdentifier task; | | | |
| | | | |
| /** | | | |
| * Identity of this peer (once started). | | | |
| */ | | | |
| struct GNUNET_PeerIdentity id; | | | |
| | | | |
| /** | | | |
| * Flag to indicate that we've already been asked | | | |
| * to terminate (but could not because some action | | | |
| * was still pending). | | | |
| */ | | | |
| int dead; | | | |
| | | | |
| /** | | | |
| * GNUNET_YES if the hostkey has been created | | | |
| * for this peer, GNUNET_NO otherwise. | | | |
| */ | | | |
| int have_hostkey; | | | |
| | | | |
| /** | | | |
| * In which phase are we during the start of | | | |
| * this process? | | | |
| */ | | | |
| enum GNUNET_TESTING_StartPhase phase; | | | |
| | | | |
| /** | | | |
| * Current position in 'hostkeybuf' (for reading from gnunet-peerinfo) | | | |
| */ | | | |
| unsigned int hostkeybufpos; | | | |
| | | | |
| /** | | | |
| * Set to GNUNET_YES once the peer is up. | | | |
| */ | | | |
| int running; | | | |
| | | | |
| /** | | | |
| * Used to tell shutdown not to remove configuration for the peer | | | |
| * (if it's going to be restarted later) | | | |
| */ | | | |
| int churn; | | | |
| | | | |
| /** | | | |
| * Output from gnunet-peerinfo is read into this buffer. | | | |
| */ | | | |
| char hostkeybuf[105]; | | | |
| | | | |
| }; | | | |
| | | | |
| /** | | | |
| * Handle to a group of GNUnet peers. | | | |
| */ | | | |
| struct GNUNET_TESTING_PeerGroup; | | | |
| | | | |
| /** | | | |
| * Prototype of a function that will be called whenever | | | |
| * two daemons are connected by the testing library. | | | |
| * | | | |
| * @param cls closure | | | |
| * @param first peer id for first daemon | | | |
| * @param second peer id for the second daemon | | | |
| * @param distance distance between the connected peers | | | |
| * @param first_cfg config for the first daemon | | | |
| * @param second_cfg config for the second daemon | | | |
| * @param first_daemon handle for the first daemon | | | |
| * @param second_daemon handle for the second daemon | | | |
| * @param emsg error message (NULL on success) | | | |
| */ | | | |
| typedef void (*GNUNET_TESTING_NotifyConnection) (void *cls, | | | |
| const struct | | | |
| GNUNET_PeerIdentity * firs | | | |
| t, | | | |
| const struct | | | |
| GNUNET_PeerIdentity * seco | | | |
| nd, | | | |
| uint32_t distance, | | | |
| const struct | | | |
| GNUNET_CONFIGURATION_Handl | | | |
| e * | | | |
| first_cfg, | | | |
| const struct | | | |
| GNUNET_CONFIGURATION_Handl | | | |
| e * | | | |
| second_cfg, | | | |
| struct GNUNET_TESTING_Daem | | | |
| on * | | | |
| first_daemon, | | | |
| struct GNUNET_TESTING_Daem | | | |
| on * | | | |
| second_daemon, | | | |
| const char *emsg); | | | |
| | | | |
| /** | | | |
| * Prototype of a callback function indicating that two peers | | | |
| * are currently connected. | | | |
| * | | | |
| * @param cls closure | | | |
| * @param first peer id for first daemon | | | |
| * @param second peer id for the second daemon | | | |
| * @param distance distance between the connected peers | | | |
| * @param emsg error message (NULL on success) | | | |
| */ | | | |
| typedef void (*GNUNET_TESTING_NotifyTopology) (void *cls, | | | |
| const struct GNUNET_PeerIden | | | |
| tity | | | |
| * first, | | | |
| const struct GNUNET_PeerIden | | | |
| tity | | | |
| * second, const char *emsg); | | | |
| | | | |
| /** | | | |
| * Starts a GNUnet daemon. GNUnet must be installed on the target | | | |
| * system and available in the PATH. The machine must furthermore be | | | |
| * reachable via "ssh" (unless the hostname is "NULL") without the | | | |
| * need to enter a password. | | | |
| * | | | |
| * @param cfg configuration to use | | | |
| * @param timeout how long to wait starting up peers | | | |
| * @param pretend GNUNET_YES to set up files but not start peer GNUNET_NO | | | |
| * to really start the peer (default) | | | |
| * @param hostname name of the machine where to run GNUnet | | | |
| * (use NULL for localhost). | | | |
| * @param ssh_username ssh username to use when connecting to hostname | | | |
| * @param sshport port to pass to ssh process when connecting to hostname | | | |
| * @param hostkey pointer to a hostkey to be written to disk (instead of be | | | |
| ing generated) | | | |
| * @param hostkey_callback function to call once the hostkey has been | | | |
| * generated for this peer, but it hasn't yet been started | | | |
| * (NULL to start immediately, otherwise waits on GNUNET_TESTING_dae | | | |
| mon_continue_start) | | | |
| * @param hostkey_cls closure for hostkey callback | | | |
| * @param cb function to call once peer is up, or failed to start | | | |
| * @param cb_cls closure for cb | | | |
| * @return handle to the daemon (actual start will be completed asynchronou | | | |
| sly) | | | |
| */ | | | |
| struct GNUNET_TESTING_Daemon * | | | |
| GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | | | |
| struct GNUNET_TIME_Relative timeout, int prete | | | |
| nd, | | | |
| const char *hostname, const char *ssh_username | | | |
| , | | | |
| uint16_t sshport, const char *hostkey, | | | |
| GNUNET_TESTING_NotifyHostkeyCreated | | | |
| hostkey_callback, void *hostkey_cls, | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Continues GNUnet daemon startup when user wanted to be notified | | | |
| * once a hostkey was generated (for creating friends files, blacklists, | | | |
| * etc.). | | | |
| * | | | |
| * @param daemon the daemon to finish starting | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon *daemo | | GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, | |
| n); | | int remove_paths); | |
| | | | |
| /** | | /** | |
|
| * Check whether the given daemon is running. | | * Testing includes a number of pre-created hostkeys for | |
| | | * faster peer startup. This function can be used to | |
| | | * access the n-th key of those pre-created hostkeys; note | |
| | | * that these keys are ONLY useful for testing and not | |
| | | * secure as the private keys are part of the public | |
| | | * GNUnet source code. | |
| * | | * | |
|
| * @param daemon the daemon to check | | * This is primarily a helper function used internally | |
| * @return GNUNET_YES if the daemon is up, GNUNET_NO if the | | * by 'GNUNET_TESTING_peer_configure'. | |
| * daemon is down, GNUNET_SYSERR on error. | | | |
| */ | | | |
| int | | | |
| GNUNET_TESTING_test_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | | | |
| | | | |
| /** | | | |
| * Obtain the peer identity of the peer with the given configuration | | | |
| * handle. This function reads the private key of the peer, obtains | | | |
| * the public key and hashes it. | | | |
| * | | | |
| * @param cfg configuration of the peer | | | |
| * @param pid where to store the peer identity | | | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on failure | | | |
| */ | | | |
| int | | | |
| GNUNET_TESTING_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle | | | |
| *cfg, | | | |
| struct GNUNET_PeerIdentity *pid); | | | |
| | | | |
| /** | | | |
| * Restart (stop and start) a GNUnet daemon. | | | |
| * | | | |
| * @param d the daemon that should be restarted | | | |
| * @param cb function called once the daemon is (re)started | | | |
| * @param cb_cls closure for cb | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Start a peer that has previously been stopped using the daemon_stop | | | |
| * call (and files weren't deleted and the allow restart flag) | | | |
| * | | | |
| * @param daemon the daemon to start (has been previously stopped) | | | |
| * @param timeout how long to wait for restart | | | |
| * @param cb the callback for notification when the peer is running | | | |
| * @param cb_cls closure for the callback | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Starts a GNUnet daemon's service. | | | |
| * | | | |
| * @param d the daemon for which the service should be started | | | |
| * @param service the name of the service to start | | | |
| * @param timeout how long to wait for process for startup | | | |
| * @param cb function called once gnunet-arm returns | | | |
| * @param cb_cls closure for cb | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | | | |
| const char *service, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Starts a GNUnet daemon's service which has been previously turned off. | | | |
| * | | | |
| * @param d the daemon for which the service should be started | | | |
| * @param service the name of the service to start | | | |
| * @param timeout how long to wait for process for startup | | | |
| * @param cb function called once gnunet-arm returns | | | |
| * @param cb_cls closure for cb | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon * | | | |
| d, | | | |
| char *service, | | | |
| struct GNUNET_TIME_Relative | | | |
| timeout, | | | |
| GNUNET_TESTING_NotifyDaemonRun | | | |
| ning | | | |
| cb, void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Get a certain testing daemon handle. | | | |
| * | | * | |
|
| * @param pg handle to the set of running peers | | * @param system the testing system handle | |
| * @param position the number of the peer to return | | * @param key_number desired pre-created hostkey to obtain | |
| | | * @param id set to the peer's identity (hash of the public | |
| | | * key; if NULL, GNUNET_SYSERR is returned immediately | |
| | | * @return NULL on error (not enough keys) | |
| */ | | */ | |
|
| struct GNUNET_TESTING_Daemon * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, | |
| unsigned int position); | | uint32_t key_number, | |
| | | struct GNUNET_PeerIdentity *id); | |
| | | | |
| /** | | /** | |
|
| * Get a daemon by peer identity, so callers can | | * Reserve a TCP or UDP port for a peer. | |
| * retrieve the daemon without knowing it's offset. | | | |
| * | | * | |
|
| * @param pg the peer group to retrieve the daemon from | | * @param system system to use for reservation tracking | |
| * @param peer_id the peer identity of the daemon to retrieve | | * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | |
| * | | * @return 0 if no free port was available | |
| * @return the daemon on success, or NULL if no such peer identity is found | | | |
| */ | | */ | |
|
| struct GNUNET_TESTING_Daemon * | | uint16_t | |
| GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system, | |
| const struct GNUNET_PeerIdentity *peer_id) | | int is_tcp); | |
| ; | | | |
| | | | |
| /** | | /** | |
|
| * Stops a GNUnet daemon. | | * Release reservation of a TCP or UDP port for a peer | |
| | | * (used during GNUNET_TESTING_peer_destroy). | |
| * | | * | |
|
| * @param d the daemon that should be stopped | | * @param system system to use for reservation tracking | |
| * @param timeout how long to wait for process for shutdown to complete | | * @param is_tcp GNUNET_YES for TCP ports, GNUNET_NO for UDP | |
| * @param cb function called once the daemon was stopped | | * @param port reserved port to release | |
| * @param cb_cls closure for cb | | | |
| * @param delete_files GNUNET_YES to remove files, GNUNET_NO | | | |
| * to leave them (i.e. for restarting at a later time, | | | |
| * or logfile inspection once finished) | | | |
| * @param allow_restart GNUNET_YES to restart peer later (using this API) | | | |
| * GNUNET_NO to kill off and clean up for good | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyCompletion cb, void *cb_cl | | | |
| s, | | | |
| int delete_files, int allow_restart); | | | |
| | | | |
| /** | | | |
| * Create a new configuration using the given configuration | | | |
| * as a template; however, each PORT in the existing cfg | | | |
| * must be renumbered by incrementing "*port". If we run | | | |
| * out of "*port" numbers, return NULL. | | | |
| * | | | |
| * @param cfg template configuration | | | |
| * @param off the current peer offset | | | |
| * @param port port numbers to use, update to reflect | | | |
| * port numbers that were used | | | |
| * @param upnum number to make unix domain socket names unique | | | |
| * @param hostname hostname of the controlling host, to allow control conne | | | |
| ctions from | | | |
| * @param fdnum number used to offset the unix domain socket for grouped pr | | | |
| ocesses | | | |
| * (such as statistics or peerinfo, which can be shared among | | | |
| others) | | | |
| * | | | |
| * @return new configuration, NULL on error | | | |
| */ | | | |
| struct GNUNET_CONFIGURATION_Handle * | | | |
| GNUNET_TESTING_create_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, u | | | |
| int32_t off, | | | |
| uint16_t * port, uint32_t * upnum, const char *hostname, | | | |
| uint32_t * fdnum); | | | |
| | | | |
| /** | | | |
| * Changes the configuration of a GNUnet daemon. | | | |
| * | | | |
| * @param d the daemon that should be modified | | | |
| * @param cfg the new configuration for the daemon | | | |
| * @param cb function called once the configuration was changed | | | |
| * @param cb_cls closure for cb | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | | GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, | |
| struct GNUNET_CONFIGURATION_Handle *cfg, | | int is_tcp, | |
| GNUNET_TESTING_NotifyCompletion cb, | | uint16_t port); | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Stops a single service of a GNUnet daemon. Used like daemon_stop, | | | |
| * only doesn't stop the entire peer in any case. If the service | | | |
| * is not currently running, this call is likely to fail after | | | |
| * timeout! | | | |
| * | | | |
| * @param d the daemon that should be stopped | | | |
| * @param service the name of the service to stop | | | |
| * @param timeout how long to wait for process for shutdown to complete | | | |
| * @param cb function called once the service was stopped | | | |
| * @param cb_cls closure for cb | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | | | |
| const char *service, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyCompletion cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | | |
| * Read a testing hosts file based on a configuration. | | | |
| * Returns a DLL of hosts (caller must free!) on success | | | |
| * or NULL on failure. | | | |
| * | | | |
| * @param cfg a configuration with a testing section | | | |
| * | | | |
| * @return DLL of hosts on success, NULL on failure | | | |
| */ | | | |
| struct GNUNET_TESTING_Host * | | | |
| GNUNET_TESTING_hosts_load (const struct GNUNET_CONFIGURATION_Handle *cfg); | | | |
| | | | |
| /** | | | |
| * Start count gnunet instances with the same set of transports and | | | |
| * applications. The port numbers (any option called "PORT") will be | | | |
| * adjusted to ensure that no two peers running on the same system | | | |
| * have the same port(s) in their respective configurations. | | | |
| * | | | |
| * @param cfg configuration template to use | | | |
| * @param total number of daemons to start | | | |
| * @param max_concurrent_connections for testing, how many peers can | | | |
| * we connect to simultaneously | | | |
| * @param max_concurrent_ssh when starting with ssh, how many ssh | | | |
| * connections will we allow at once (based on remote hosts allowed! | | | |
| ) | | | |
| * @param timeout total time allowed for peers to start | | | |
| * @param hostkey_callback function to call on each peers hostkey generatio | | | |
| n | | | |
| * if NULL, peers will be started by this call, if non-null, | | | |
| * GNUNET_TESTING_daemons_continue_startup must be called after | | | |
| * successful hostkey generation | | | |
| * @param hostkey_cls closure for hostkey callback | | | |
| * @param cb function to call on each daemon that was started | | | |
| * @param cb_cls closure for cb | | | |
| * @param connect_callback function to call each time two hosts are connect | | | |
| ed | | | |
| * @param connect_callback_cls closure for connect_callback | | | |
| * @param hostnames linked list of host structs to use to start peers on | | | |
| * (NULL to run on localhost only) | | | |
| * | | | |
| * @return NULL on error, otherwise handle to control peer group | | | |
| */ | | | |
| struct GNUNET_TESTING_PeerGroup * | | | |
| GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg | | | |
| , | | | |
| unsigned int total, | | | |
| unsigned int max_concurrent_connections, | | | |
| unsigned int max_concurrent_ssh, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyHostkeyCreated | | | |
| hostkey_callback, void *hostkey_cls, | | | |
| GNUNET_TESTING_NotifyDaemonRunning cb, | | | |
| void *cb_cls, | | | |
| GNUNET_TESTING_NotifyConnection connect_callb | | | |
| ack, | | | |
| void *connect_callback_cls, | | | |
| const struct GNUNET_TESTING_Host *hostnames); | | | |
| | | | |
| /** | | /** | |
|
| * Function which continues a peer group starting up | | * Create a new configuration using the given configuration as a template; | |
| * after successfully generating hostkeys for each peer. | | * ports and paths will be modified to select available ports on the local | |
| | | * system. The default configuration will be available in PATHS section und | |
| | | er | |
| | | * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PAT | |
| | | HS | |
| | | * section to the temporary directory specific to this configuration. If we | |
| | | run | |
| | | * out of "*port" numbers, return SYSERR. | |
| * | | * | |
|
| * @param pg the peer group to continue starting | | * This is primarily a helper function used internally | |
| */ | | * by 'GNUNET_TESTING_peer_configure'. | |
| void | | | |
| GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *p | | | |
| g); | | | |
| | | | |
| /** | | | |
| * Handle for an active request to connect two peers. | | | |
| */ | | | |
| struct GNUNET_TESTING_ConnectContext; | | | |
| | | | |
| /** | | | |
| * Establish a connection between two GNUnet daemons. The daemons | | | |
| * must both be running and not be stopped until either the | | | |
| * 'cb' callback is called OR the connection request has been | | | |
| * explicitly cancelled. | | | |
| * | | * | |
|
| * @param d1 handle for the first daemon | | * @param system system to use to coordinate resource usage | |
| * @param d2 handle for the second daemon | | * @param cfg template configuration to update | |
| * @param timeout how long is the connection attempt | | * @return GNUNET_OK on success, GNUNET_SYSERR on error - the configuration | |
| * allowed to take? | | will | |
| * @param max_connect_attempts how many times should we try to reconnect | | * be incomplete and should not be used there upon | |
| * (within timeout) | | | |
| * @param send_hello GNUNET_YES to send the HELLO, GNUNET_NO to assume | | | |
| * the HELLO has already been exchanged | | | |
| * @param cb function to call at the end | | | |
| * @param cb_cls closure for cb | | | |
| * @return handle to cancel the request, NULL on error | | | |
| */ | | */ | |
|
| struct GNUNET_TESTING_ConnectContext * | | int | |
| GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | | GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, | |
| struct GNUNET_TESTING_Daemon *d2, | | struct GNUNET_CONFIGURATION_Handle *cfg | |
| struct GNUNET_TIME_Relative timeout, | | ); | |
| unsigned int max_connect_attempts, | | // FIXME: add dual to 'release' ports again... | |
| int send_hello, | | | |
| GNUNET_TESTING_NotifyConnection cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | /** | |
|
| * Cancel an attempt to connect two daemons. | | * Configure a GNUnet peer. GNUnet must be installed on the local | |
| | | * system and available in the PATH. | |
| * | | * | |
|
| * @param cc connect context | | * @param system system to use to coordinate resource usage | |
| | | * @param cfg configuration to use; will be UPDATED (to reflect needed | |
| | | * changes in port numbers and paths) | |
| | | * @param key_number number of the hostkey to use for the peer | |
| | | * @param id identifier for the daemon, will be set, can be NULL | |
| | | * @param emsg set to freshly allocated error message (set to NULL on succe | |
| | | ss), | |
| | | * can be NULL | |
| | | * @return handle to the peer, NULL on error | |
| */ | | */ | |
|
| void | | struct GNUNET_TESTING_Peer * | |
| GNUNET_TESTING_daemons_connect_cancel (struct GNUNET_TESTING_ConnectContext | | GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | |
| *cc); | | struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | uint32_t key_number, | |
| | | struct GNUNET_PeerIdentity *id, | |
| | | char **emsg); | |
| | | | |
| /** | | /** | |
|
| * Restart all peers in the given group. | | * Obtain the peer identity from a peer handle. | |
| * | | * | |
|
| * @param pg the handle to the peer group | | * @param peer peer handle for which we want the peer's identity | |
| * @param callback function to call on completion (or failure) | | * @param id identifier for the daemon, will be set | |
| * @param callback_cls closure for the callback function | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer, | |
| GNUNET_TESTING_NotifyCompletion callback, | | struct GNUNET_PeerIdentity *id); | |
| void *callback_cls); | | | |
| | | | |
| /** | | /** | |
|
| * Shutdown all peers started in the given group. | | * Start the peer. | |
| * | | * | |
|
| * @param pg handle to the peer group | | * @param peer peer to start | |
| * @param timeout how long to wait for shutdown | | * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer already | |
| * @param cb callback to notify upon success or failure | | running) | |
| * @param cb_cls closure for cb | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyCompletion cb, void *cb_c | | | |
| ls); | | | |
| | | | |
| /** | | | |
| * Count the number of running peers. | | | |
| * | | | |
| * @param pg handle for the peer group | | | |
| * | | | |
| * @return the number of currently running peers in the peer group | | | |
| */ | | | |
| unsigned int | | | |
| GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg); | | | |
| | | | |
| /** | | | |
| * Simulate churn by stopping some peers (and possibly | | | |
| * re-starting others if churn is called multiple times). This | | | |
| * function can only be used to create leave-join churn (peers "never" | | | |
| * leave for good). First "voff" random peers that are currently | | | |
| * online will be taken offline; then "von" random peers that are then | | | |
| * offline will be put back online. No notifications will be | | | |
| * generated for any of these operations except for the callback upon | | | |
| * completion. Note that the implementation is at liberty to keep | | | |
| * the ARM service itself (but none of the other services or daemons) | | | |
| * running even though the "peer" is being varied offline. | | | |
| * | | | |
| * @param pg handle for the peer group | | | |
| * @param service the service to churn on/off, NULL for all | | | |
| * @param voff number of peers that should go offline | | | |
| * @param von number of peers that should come back online; | | | |
| * must be zero on first call (since "testbed_start" | | | |
| * always starts all of the peers) | | | |
| * @param timeout how long to wait for operations to finish before | | | |
| * giving up | | | |
| * @param cb function to call at the end | | | |
| * @param cb_cls closure for cb | | | |
| */ | | */ | |
|
| void | | int | |
| GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); | |
| char *service, unsigned int voff, | | | |
| unsigned int von, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyCompletion cb, void *cb_ | | | |
| cls); | | | |
| | | | |
| /** | | /** | |
|
| * Start a given service for each of the peers in the peer group. | | * Stop the peer. | |
| * | | | |
| * @param pg handle for the peer group | | | |
| * @param service the service to start | | | |
| * @param timeout how long to wait for operations to finish before | | | |
| * giving up | | | |
| * @param cb function to call once finished | | | |
| * @param cb_cls closure for cb | | | |
| * | | * | |
|
| | | * @param peer peer to stop | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. peer not runn | |
| | | ing) | |
| */ | | */ | |
|
| void | | int | |
| GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer); | |
| char *service, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyCompletion cb, | | | |
| void *cb_cls); | | | |
| | | | |
| /** | | /** | |
|
| * Callback function to process statistic values. | | * Destroy the peer. Releases resources locked during peer configuration. | |
| | | * If the peer is still running, it will be stopped AND a warning will be | |
| | | * printed (users of the API should stop the peer explicitly first). | |
| * | | * | |
|
| * @param cls closure | | * @param peer peer to destroy | |
| * @param peer the peer the statistics belong to | | | |
| * @param subsystem name of subsystem that created the statistic | | | |
| * @param name the name of the datum | | | |
| * @param value the current value | | | |
| * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if | | | |
| not | | | |
| * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | | | |
| */ | | | |
| typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls, | | | |
| const struct | | | |
| GNUNET_PeerIdentity * pe | | | |
| er, | | | |
| const char *subsystem, | | | |
| const char *name, | | | |
| uint64_t value, | | | |
| int is_persistent); | | | |
| | | | |
| /** | | | |
| * Iterate over all (running) peers in the peer group, retrieve | | | |
| * all statistics from each. | | | |
| * | | | |
| * @param pg the peergroup to iterate statistics of | | | |
| * @param cont continuation to call once call is completed(?) | | | |
| * @param proc processing function for each statistic retrieved | | | |
| * @param cls closure to pass to proc | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); | |
| GNUNET_STATISTICS_Callback cont, | | | |
| GNUNET_TESTING_STATISTICS_Iterator proc, | | | |
| void *cls); | | | |
| | | | |
| /** | | /** | |
|
| * Topologies supported for testbeds. | | * Sends SIGTERM to the peer's main process | |
| */ | | | |
| enum GNUNET_TESTING_Topology | | | |
| { | | | |
| /** | | | |
| * A clique (everyone connected to everyone else). | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_CLIQUE, | | | |
| | | | |
| /** | | | |
| * Small-world network (2d torus plus random links). | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_SMALL_WORLD, | | | |
| | | | |
| /** | | | |
| * Small-world network (ring plus random links). | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING, | | | |
| | | | |
| /** | | | |
| * Ring topology. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_RING, | | | |
| | | | |
| /** | | | |
| * 2-d torus. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_2D_TORUS, | | | |
| | | | |
| /** | | | |
| * Random graph. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI, | | | |
| | | | |
| /** | | | |
| * Certain percentage of peers are unable to communicate directly | | | |
| * replicating NAT conditions | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_INTERNAT, | | | |
| | | | |
| /** | | | |
| * Scale free topology. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_SCALE_FREE, | | | |
| | | | |
| /** | | | |
| * Straight line topology. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_LINE, | | | |
| | | | |
| /** | | | |
| * All peers are disconnected. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_NONE, | | | |
| | | | |
| /** | | | |
| * Read a topology from a given file. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_FROM_FILE | | | |
| }; | | | |
| | | | |
| /** | | | |
| * Options for connecting a topology. | | | |
| */ | | | |
| enum GNUNET_TESTING_TopologyOption | | | |
| { | | | |
| /** | | | |
| * Try to connect all peers specified in the topology. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_ALL, | | | |
| | | | |
| /** | | | |
| * Choose a random subset of connections to create. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_RANDOM, | | | |
| | | | |
| /** | | | |
| * Create at least X connections for each peer. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_MINIMUM, | | | |
| | | | |
| /** | | | |
| * Using a depth first search, create one connection | | | |
| * per peer. If any are missed (graph disconnected) | | | |
| * start over at those peers until all have at least one | | | |
| * connection. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_DFS, | | | |
| | | | |
| /** | | | |
| * Find the N closest peers to each allowed peer in the | | | |
| * topology and make sure a connection to those peers | | | |
| * exists in the connect topology. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_ADD_CLOSEST, | | | |
| | | | |
| /** | | | |
| * No options specified. | | | |
| */ | | | |
| GNUNET_TESTING_TOPOLOGY_OPTION_NONE | | | |
| }; | | | |
| | | | |
| /** | | | |
| * Get a topology from a string input. | | | |
| * | | | |
| * @param topology where to write the retrieved topology | | | |
| * @param topology_string The string to attempt to | | | |
| * get a configuration value from | | | |
| * @return GNUNET_YES if topology string matched a | | | |
| * known topology, GNUNET_NO if not | | | |
| */ | | | |
| int | | | |
| GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, | | | |
| const char *topology_string); | | | |
| | | | |
| /** | | | |
| * Get connect topology option from string input. | | | |
| * | | * | |
|
| * @param topology_option where to write the retrieved topology | | * @param peer the handle to the peer | |
| * @param topology_string The string to attempt to | | * @return GNUNET_OK if successful; GNUNET_SYSERR if the main process is NU | |
| * get a configuration value from | | LL | |
| * @return GNUNET_YES if topology string matched a | | * or upon any error while sending SIGTERM | |
| * known topology, GNUNET_NO if not | | | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption | | GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer); | |
| *topology_option, | | | |
| const char *topology_string); | | | |
| | | | |
| /** | | | |
| * Takes a peer group and creates a topology based on the | | | |
| * one specified. Creates a topology means generates friend | | | |
| * files for the peers so they can only connect to those allowed | | | |
| * by the topology. This will only have an effect once peers | | | |
| * are started if the FRIENDS_ONLY option is set in the base | | | |
| * config. | | | |
| * | | | |
| * Also takes an optional restrict topology which | | | |
| * disallows direct connections UNLESS they are specified in | | | |
| * the restricted topology. | | | |
| * | | | |
| * A simple example; if the topology option is set to LINE | | | |
| * peers can ONLY connect in a LINE. However, if the topology | | | |
| * option is set to 2D-torus and the restrict option is set to | | | |
| * line with restrict_transports equal to "tcp udp", then peers | | | |
| * may connect in a 2D-torus, but will be restricted to tcp and | | | |
| * udp connections only in a LINE. Generally it only makes | | | |
| * sense to do this if restrict_topology is a subset of topology. | | | |
| * | | | |
| * For testing peer discovery, etc. it is generally better to | | | |
| * leave restrict_topology as GNUNET_TESTING_TOPOLOGY_NONE and | | | |
| * then use the connect_topology function to restrict the initial | | | |
| * connection set. | | | |
| * | | | |
| * @param pg the peer group struct representing the running peers | | | |
| * @param topology which topology to connect the peers in | | | |
| * @param restrict_topology allow only direct connections in this topology, | | | |
| * based on those listed in restrict_transports, set to | | | |
| * GNUNET_TESTING_TOPOLOGY_NONE for no restrictions | | | |
| * @param restrict_transports space delimited list of transports to blackli | | | |
| st | | | |
| * to create restricted topology, NULL for none | | | |
| * | | | |
| * @return the maximum number of connections were all allowed peers | | | |
| * connected to each other | | | |
| */ | | | |
| unsigned int | | | |
| GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | | | |
| enum GNUNET_TESTING_Topology topology, | | | |
| enum GNUNET_TESTING_Topology restrict_topol | | | |
| ogy, | | | |
| const char *restrict_transports); | | | |
| | | | |
| /** | | | |
| * Iterate over all (running) peers in the peer group, retrieve | | | |
| * all connections that each currently has. | | | |
| * | | | |
| * @param pg the peer group we are concerned with | | | |
| * @param cb callback for topology information | | | |
| * @param cls closure for callback | | | |
| */ | | | |
| void | | | |
| GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, | | | |
| GNUNET_TESTING_NotifyTopology cb, void *cls); | | | |
| | | | |
| /** | | /** | |
|
| * Stop the connection process temporarily. | | * Waits for a peer to terminate. The peer's main process will also be dest
royed. | |
| * | | * | |
|
| * @param pg the peer group to stop connecting | | * @param peer the handle to the peer | |
| | | * @return GNUNET_OK if successful; GNUNET_SYSERR if the main process is NU | |
| | | LL | |
| | | * or upon any error while waiting | |
| */ | | */ | |
|
| void | | int | |
| GNUNET_TESTING_stop_connections (struct GNUNET_TESTING_PeerGroup *pg); | | GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer); | |
| | | | |
| /** | | /** | |
|
| * Resume the connection process. | | * Signature of the 'main' function for a (single-peer) testcase that | |
| | | * is run using 'GNUNET_TESTING_peer_run'. | |
| * | | * | |
|
| * @param pg the peer group to resume connecting | | * @param cls closure | |
| | | * @param cfg configuration of the peer that was started | |
| | | * @param peer identity of the peer that was created | |
| */ | | */ | |
|
| void | | typedef void (*GNUNET_TESTING_TestMain)(void *cls, | |
| GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg); | | const struct GNUNET_CONFIGURATION_Ha | |
| | | ndle *cfg, | |
| /** | | struct GNUNET_TESTING_Peer *peer); | |
| * There are many ways to connect peers that are supported by this function | | | |
| . | | /** | |
| * To connect peers in the same topology that was created via the | | * Start a single peer and run a test using the testing library. | |
| * GNUNET_TESTING_create_topology, the topology variable must be set to | | * Starts a peer using the given configuration and then invokes the | |
| * GNUNET_TESTING_TOPOLOGY_NONE. If the topology variable is specified, | | * given callback. This function ALSO initializes the scheduler loop | |
| * a new instance of that topology will be generated and attempted to be | | * and should thus be called directly from "main". The testcase | |
| * connected. This could result in some connections being impossible, | | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | |
| * because some topologies are non-deterministic. | | * | |
| * | | * @param testdir only the directory name without any path. This is used fo | |
| * @param pg the peer group struct representing the running peers | | r | |
| * @param topology which topology to connect the peers in | | * all service homes; the directory will be created in a temporary | |
| * @param options options for connecting the topology | | * location depending on the underlying OS | |
| * @param option_modifier modifier for options that take a parameter | | * @param cfgfilename name of the configuration file to use; | |
| * @param connect_timeout how long to wait before giving up on connecting | | * use NULL to only run with defaults | |
| * two peers | | * @param tm main function of the testcase | |
| * @param connect_attempts how many times to attempt to connect two peers | | * @param tm_cls closure for 'tm' | |
| * over the connect_timeout duration | | * @return 0 on success, 1 on error | |
| * @param notify_callback notification to be called once all connections co | | | |
| mpleted | | | |
| * @param notify_cls closure for notification callback | | | |
| * | | | |
| * @return the number of connections that will be attempted, GNUNET_SYSERR | | | |
| on error | | | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_peer_run (const char *testdir, | |
| enum GNUNET_TESTING_Topology topology, | | const char *cfgfilename, | |
| enum GNUNET_TESTING_TopologyOption options | | GNUNET_TESTING_TestMain tm, | |
| , | | void *tm_cls); | |
| double option_modifier, | | | |
| struct GNUNET_TIME_Relative connect_timeou | | /** | |
| t, | | * Start a single service (no ARM, except of course if the given | |
| unsigned int connect_attempts, | | * service name is 'arm') and run a test using the testing library. | |
| GNUNET_TESTING_NotifyCompletion | | * Starts a service using the given configuration and then invokes the | |
| notify_callback, void *notify_cls); | | * given callback. This function ALSO initializes the scheduler loop | |
| | | * and should thus be called directly from "main". The testcase | |
| /** | | * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'. | |
| * Start or stop an individual peer from the given group. | | * | |
| * | | * This function is useful if the testcase is for a single service | |
| * @param pg handle to the peer group | | * and if that service doesn't itself depend on other services. | |
| * @param offset which peer to start or stop | | * | |
| * @param desired_status GNUNET_YES to have it running, GNUNET_NO to stop i | | * @param testdir only the directory name without any path. This is used fo | |
| t | | r | |
| * @param timeout how long to wait for shutdown | | * all service homes; the directory will be created in a temporary | |
| * @param cb function to call at the end | | * location depending on the underlying OS | |
| * @param cb_cls closure for cb | | * @param service_name name of the service to run | |
| | | * @param cfgfilename name of the configuration file to use; | |
| | | * use NULL to only run with defaults | |
| | | * @param tm main function of the testcase | |
| | | * @param tm_cls closure for 'tm' | |
| | | * @return 0 on success, 1 on error | |
| */ | | */ | |
|
| void | | int | |
| GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, | | GNUNET_TESTING_service_run (const char *testdir, | |
| unsigned int offset, int desired_status, | | const char *service_name, | |
| struct GNUNET_TIME_Relative timeout, | | const char *cfgfilename, | |
| GNUNET_TESTING_NotifyCompletion cb, void *cb_c | | GNUNET_TESTING_TestMain tm, | |
| ls); | | void *tm_cls); | |
| | | | |
| /** | | /** | |
| * Start a peer group with a given number of peers. Notify | | * Sometimes we use the binary name to determine which specific | |
| * on completion of peer startup and connection based on given | | * test to run. In those cases, the string after the last "_" | |
| * topological constraints. Optionally notify on each | | * in 'argv[0]' specifies a string that determines the configuration | |
| * established connection. | | * file or plugin to use. | |
| * | | * | |
| * @param cfg configuration template to use | | * This function returns the respective substring, taking care | |
| * @param total number of daemons to start | | * of issues such as binaries ending in '.exe' on W32. | |
| * @param timeout total time allowed for peers to start | | * | |
| * @param connect_cb function to call each time two daemons are connected | | * @param argv0 the name of the binary | |
| * @param peergroup_cb function to call once all peers are up and connected | | * @return string between the last '_' and the '.exe' (or the end of the st | |
| * @param peergroup_cls closure for peergroup callbacks | | ring), | |
| * @param hostnames linked list of host structs to use to start peers on | | * NULL if argv0 has no '_' | |
| * (NULL to run on localhost only) | | | |
| * | | | |
| * @return NULL on error, otherwise handle to control peer group | | | |
| */ | | | |
| struct GNUNET_TESTING_PeerGroup * | | | |
| GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *c | | | |
| fg, | | | |
| unsigned int total, | | | |
| struct GNUNET_TIME_Relative timeout, | | | |
| GNUNET_TESTING_NotifyConnection connect_cb, | | | |
| GNUNET_TESTING_NotifyCompletion peergroup_c | | | |
| b, | | | |
| void *peergroup_cls, | | | |
| const struct GNUNET_TESTING_Host *hostnames | | | |
| ); | | | |
| | | | |
| /** | | | |
| * Print current topology to a graphviz readable file. | | | |
| * | | | |
| * @param pg a currently running peergroup to print to file | | | |
| * @param output_filename the file to write the topology to | | | |
| * @param notify_cb callback to call upon completion or failure | | | |
| * @param notify_cb_cls closure for notify_cb | | | |
| * | | | |
| */ | | */ | |
|
| void | | char * | |
| GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup | | GNUNET_TESTING_get_testname_from_underscore (const char *argv0); | |
| *pg, | | | |
| const char *output_filename, | | | |
| GNUNET_TESTING_NotifyCompletion | | | |
| notify_cb, void *notify_cb_cls); | | | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 57 change blocks. |
| 1147 lines changed or deleted | | 257 lines changed or added | |
|