2016-03-29 06:24:54 +00:00
|
|
|
#define _GNU_SOURCE 1
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <netinet/udp.h>
|
|
|
|
#include <netinet/icmp6.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "nest/bird.h"
|
|
|
|
#include "lib/lists.h"
|
|
|
|
#include "lib/resource.h"
|
|
|
|
#include "lib/timer.h"
|
|
|
|
#include "lib/socket.h"
|
|
|
|
#include "lib/event.h"
|
|
|
|
#include "lib/string.h"
|
|
|
|
#include "nest/iface.h"
|
|
|
|
#include "lib/string.h"
|
|
|
|
|
|
|
|
#include "lib/unix.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define PKT_PORT 100
|
|
|
|
#define PKT_VALUE 0
|
2016-04-06 13:46:02 +00:00
|
|
|
#define PKT_MAGIC 0x12345678
|
2016-03-29 06:24:54 +00:00
|
|
|
|
2016-04-06 13:46:02 +00:00
|
|
|
struct socktest_packet
|
2016-03-29 06:24:54 +00:00
|
|
|
{
|
|
|
|
u32 magic;
|
|
|
|
u32 value;
|
|
|
|
u32 count;
|
|
|
|
};
|
|
|
|
|
2016-04-01 07:38:14 +00:00
|
|
|
int cf_mcast; /* Set up multicast */
|
|
|
|
int cf_bcast; /* Enable broadcast */
|
|
|
|
int cf_bind; /* Bind by address */
|
|
|
|
uint cf_count; /* How many packets send */
|
2016-04-06 13:46:02 +00:00
|
|
|
uint counter; /* Global counter of send/recv packets */
|
|
|
|
uint cf_value; /* Value in packet */
|
2016-03-29 06:24:54 +00:00
|
|
|
|
2016-04-06 13:46:02 +00:00
|
|
|
sock *socktest_parse_args(int argc, char **argv, int is_send);
|
|
|
|
void socktest_bird_init(void);
|
|
|
|
void socktest_open(sock *s);
|
2016-03-29 06:24:54 +00:00
|
|
|
|
|
|
|
/* implementation in io.c */
|
|
|
|
int sk_write(sock *s);
|
|
|
|
int sk_read(sock *s);
|