1/* 2 * Copyright (c) 2007-12 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9#ifndef TCP_SERVER_BM_H_ 10#define TCP_SERVER_BM_H_ 11 12// ****************************************************************** 13// TCP benchmark related 14// ****************************************************************** 15 16// Initializes the tcp server benchmark 17// essentially it starts listening on given port 18int tcp_server_bm_init(uint16_t bind_port); 19 20// initialize tcp connection for the client 21int tcp_client_bm_init(char *ip_addr_str, uint16_t server_port); 22 23// send single message over TCP connection 24int send_message_client(void *msg, size_t len); 25 26// ****************************************************************** 27// UDP benchmark related 28// ****************************************************************** 29 30int udp_server_bm_init(uint16_t bind_port); 31 32int udp_client_bm_init(char *ip_addr_str, uint16_t server_port); 33 34void *prepare_udp_buffer(size_t payload_size); 35 36int send_udp_message_client(void); 37 38 39// ****************************************************************** 40// Calls back in the benchmarking code whenever there is data 41// ****************************************************************** 42// to be called from tcp_server.c code 43 44// Informs the benchmarking code about initialization of connection 45void handle_connection_opened(void); 46 47// Informs the benchmarking code about arrival of data 48void handle_data_arrived(char *payload, size_t data_len); 49 50 51#endif // TCP_SERVER_BM_H_ 52 53