]> rtime.felk.cvut.cz Git - frescor/fwp.git/blobdiff - fwp/lib/core/fwp_endpoint.c
Added option FWP_CONTNEGT. If not defined, fwp can be tested without contract negotia...
[frescor/fwp.git] / fwp / lib / core / fwp_endpoint.c
index 940dbbcda3ba06a82cab46cfa5533bd8d73588d8..ee031440829c329d9c9fb4ee5526724ac72906da 100644 (file)
@@ -179,6 +179,14 @@ int fwp_send_endpoint_create(unsigned int node,
        }
        
        FWP_DEBUG("FWP Send endpoint created.\n"); 
+
+#ifndef FWP_CONTNEGT
+       /* Create vres with default parameters */
+       if (fwp_vres_create(&fwp_vres_params_default, &fwp_epoint->vresd)) {
+               goto err;
+       }
+#endif
+       
        *epoint = fwp_epoint;
        return 0;               
 err:
@@ -220,7 +228,7 @@ int fwp_receive_endpoint_create(unsigned int port,
        addr->sin_family = AF_INET;
        /* TODO: set listen interface, maybe through config struct*/
        addr->sin_addr.s_addr = INADDR_ANY;
-       addr->sin_port = htons(port);
+       fwp_epoint->port  = addr->sin_port = htons(port);
         fwp_epoint->peer.addrlen = sizeof(struct sockaddr_in);
        
        if (fwp_epoint->attr.reliability == FWP_EPOINT_RELIABLE) {
@@ -308,16 +316,20 @@ err:
  */
 int fwp_send_endpoint_bind(fwp_endpoint_t *epoint, fwp_vres_d_t vresd)
 {
-       int rv ;
+       int rv;
        fwp_endpoint_t *fwp_epoint = epoint;
        
+#ifndef FWP_CONTNEGT
+       FWP_DEBUG("Empty bind\n");
+       rv = fwp_vres_bind(fwp_epoint->vresd, fwp_epoint->sockd);
+#else  
        fwp_epoint->vresd = vresd;      
        rv = fwp_vres_bind(vresd, fwp_epoint->sockd);
        /* if send endpoint is already bound 
        if (epoint->type == FWP_EPOINT_BOUND) {  
                fwp_send_endpoint_unbind(epoint);
        }*/
-       
+#endif 
        return rv;
 }
 
@@ -469,7 +481,6 @@ ssize_t fwp_recv(fwp_endpoint_t *endpoint,
        
                if (FD_ISSET(fwp_epoint->sockd, &fdset)) { /* is it listen socket? */
                        fwp_receive_endpoint_accept(fwp_epoint);
-                       FWP_DEBUG("After accepted\n");
                        continue;
                }