1 #define CONFIGURE_FWP_MNGT 0
2 #include "fwp_confdefs.h"
12 // struct sockaddr_in local_addr, rem_addr, from;
14 fwp_vres_d_t vresd1, vresd2;
15 struct fwp_vres_params vparam1;
18 fwp_endpoint_d_t sepoint_d1, repoint_d;
20 struct timespec sendtime;
21 fwp_endpoint_attr_t attr ;
23 fwp_endpoint_attr_init(&attr);
24 vparam1.ac_id = FWP_AC_VO;
26 vparam1.period_usec = 2111111;
29 if (fwp_init() != 0) {
30 printf("fwp_init failed!\n");
34 printf("Create vres1\n");
35 if ((fwp_vres_create(&vparam1, &vresd1) < 0)) {
36 printf("Unable to create vres1\n");
39 printf("Vres1 created\n");
41 printf("Create vres2\n");
42 if ((fwp_vres_create(&vparam1, &vresd2) < 0)) {
43 printf("Unable to create vres2\n");
46 printf("Vres2 created\n");
47 /* local_addr should be handled when creating socket */
48 if (fwp_receive_endpoint_create(7777, &attr, &repoint_d) < 0) {
51 printf("Receive endpoint created\n");
53 if (fwp_send_endpoint_create(inet_addr("127.0.0.1"), 7777, &attr,
57 printf("Send endpoint 1 created\n");
58 fwp_send_endpoint_bind(sepoint_d1, vresd1);
60 for (count = 0; count < NUM; count++) {
61 sprintf(msg1,"msg%d",count);
62 fwp_send(sepoint_d1, msg1, sizeof(msg1), 0);
64 clock_gettime(CLOCK_MONOTONIC, &sendtime);
65 FWP_DEBUG("Sent: sec = %ld nsec = %ld \n", sendtime.tv_sec,
68 if ((len = fwp_recv(repoint_d, buffer, sizeof(buffer), 0)) < 0) {
69 perror("Error while receiving data");
72 else printf("Received - %s\n", buffer);
75 if (fwp_vres_destroy(vresd1) < 0) {
76 perror("Unable to destroy vres1\n");
79 printf("Vres1 detroyed\n");
80 printf("Test PASSED!\n");