/********************************************/ /* network_config.h 0.2.0 (1999-Dec-19-Sun) */ /* Adam M. Costello */ /********************************************/ /* Configure the behavior of the network layer. */ /* This is ANSI C code. */ #ifndef NETWORK_CONFIG_H #define NETWORK_CONFIG_H #include "network.h" struct network_path_parameters { size_t max_payload_length; /* default = 556 (bytes) */ double bit_error_rate; /* default = 0.0 */ double drop_probability; /* default = 0.0 */ double duplicate_probability; /* default = 0.0 */ double delay_constant; /* default = 0.01 (seconds) */ double delay_per_bit; /* default = 0.0 (seconds) */ double delay_random_max; /* default = 0.0 (seconds) */ }; struct network_bottleneck_parameters { double packet_cost; /* default = 1.0 */ double payload_byte_cost; /* default = 0.0 */ double budget; /* default = 0.0 (means infinite) */ }; struct network_statistics { unsigned long packets_sent; /* Includes duplicates & drops. */ unsigned long packets_dropped; /* For any reason. */ }; void network_path_config( struct network_address source, struct network_address destination, struct network_path_parameters parameters ); /* Sets the parameters for the path from the source to the */ /* destination (but not the other way). Each packet sent */ /* will be dropped with the given probability. Otherwise, */ /* it will be duplicated with the given probability (by a */ /* recursive call to network_send_packet()). Then each bit of */ /* the payload will be inverted with the given probability. */ /* Then the packet will be delivered after delay_constant plus */ /* delay_per_bit * payload_length * 8 plus a random delay of at */ /* most delay_random_max. */ void network_bottleneck_config( struct network_bottleneck_parameters parameters ); /* Sets the parameters of the network bottleneck. We assume an */ /* extremely simple model in which the bottleneck includes the */ /* entirety of every path. The cost of the network resources */ /* currently in use is packet_cost times the total number of */ /* packets in the network plus payload_byte_cost times the total */ /* number of payload bytes in the network. If the budget is */ /* nonzero and an entering packet would cause the budget to be */ /* exceeded, the packet is dropped. */ struct network_statistics network_statistics(void); /* Returns statistics. */ #endif /* NETWORK_CONFIG_H */