#include <arpa/inet.h>
#include <wvtest.h>
#include <fwp_res.h>
-
-char msg[MSGBUFFSIZE];
-
-frsh_resource_id_t resource_id = TEST_RESOURCE_ID;
-frsh_stream_id_t stream_id = TEST_STREAM_ID;
-long int num_msg = TEST_NUM_MSG;
-size_t msg_size = MSGBUFFSIZE;
-int receiver()
+#include "fwp_confdefs.h"
+#include "fwp.h"
+
+int main(int argc, char* argv[])
{
+ int opt;
+ opterr = 0;
+ bool opt_daemon = false;
+ char *opt_pidfile = NULL;
size_t len;
frsh_receive_endpoint_t repoint;
int count;
-
frsh_network_address_t from;
frsh_receive_endpoint_protocol_info_t recv_pinfo;
- frsh_endpoint_queueing_info_t qinfo;
-
- recv_pinfo.body = NULL;
+ //frsh_endpoint_queueing_info_t qinfo;
+ //frsh_resource_id_t resource_id = TEST_RESOURCE_ID;
+ frsh_stream_id_t stream_id = TEST_STREAM_ID;
+ long int num_msg = TEST_NUM_MSG;
+ size_t msg_size = MSGBUFFSIZE;
+ char msg[MSGBUFFSIZE];
- /* local_addr should be handled when creating socket */
- //TODO: Segmentation fault in wvtest.sh file after calling WVPASSNE
- //WVPASSNE(frsh_receive_endpoint_create(resource_id, stream_id, qinfo, recv_pinfo, &repoint), 0);
- if (frsh_receive_endpoint_create(resource_id, stream_id, qinfo, recv_pinfo,
- &repoint) != 0){
- return 0;
- }
- count = 0;
- while (count != num_msg){
- count++;
- WVPASSEQ(frsh_receive_sync(repoint, msg, msg_size, &len, &from), msg_size);
- }
-
- /* TODO: destroy vres and send enpoint */
-
- return 1;
-}
-
-int main(int argc, char* argv[])
-{
- int opt;
- opterr = 0;
+ recv_pinfo.body = NULL;
- bool opt_daemon = false;
- char *opt_pidfile = NULL;
+ fwp_endpoint_attr_t attr;
+ fwp_endpoint_attr_init(&attr);
while ((opt = getopt (argc, argv, "e:p:m:")) != -1) {
forb_daemon_prepare(opt_pidfile);
WVFRSH(frsh_init());
- WVPASSEQ(receiver(), 1);
+
+ /* local_addr should be handled when creating socket */
+ //TODO: Segmentation fault in wvtest.sh file after calling WVPASSNE
+ //WVPASSNE(frsh_receive_endpoint_create(resource_id, stream_id, qinfo, recv_pinfo, &repoint), 0);
+ //if (frsh_receive_endpoint_create(resource_id, stream_id, qinfo, recv_pinfo,
+ // &repoint) != 0){
+ // printf("Receive endpoint not created\n");
+ // return -1;
+ //}
+ //TODO: Change to FRSH_RECEIVE function
+ if (fwp_receive_endpoint_create(stream_id, &attr, &repoint) < 0){
+ return -1;
+ }
+ printf("Receive endpoint created\n");
+
+ count = 0;
+ while (count != num_msg){
+ count++;
+ //TODO: Check return value & add WVTEST macro
+ frsh_receive_sync(repoint, msg, msg_size, &len, &from);
+ }
return 0;
}