]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
Added option FWP_CONTNEGT. If not defined, fwp can be tested without contract negotia...
authorMartin <molnam1@fel.cvut.cz>
Wed, 22 Oct 2008 14:26:14 +0000 (16:26 +0200)
committerMartin <molnam1@fel.cvut.cz>
Wed, 22 Oct 2008 14:26:14 +0000 (16:26 +0200)
fwp/Makefile.omk
fwp/lib/Makefile.omk
fwp/lib/core/fwp_endpoint.c
fwp/lib/core/fwp_vres.c
fwp/lib/core/fwp_vres.h
fwp/lib/fwp_fna.c

index 03b85661701249ffd7e0a1ff46c4f1927c4ed5ec..5bb20ff47086fe6e02b8e29de8d94bb9b31490d9 100644 (file)
@@ -1,2 +1,2 @@
 #SUBDIRS = $(ALL_OMK_SUBDIRS)
-SUBDIRS = lib tests
+SUBDIRS = ulut lib tests
index c1f7401dc8fa0f7f4c9b8db0a51987a791de6038..31796c52f13015bfebc5a5de1e8fe87a85494859 100644 (file)
@@ -1,4 +1,5 @@
-lib_LIBRARIES = fwp
+#lib_LIBRARIES = fwp
+shared_LIBRARIES = fwp
 CFLAGS += -D_FWP_INTERNALS_
 SUBDIRS = core  
 #LDFLAGS = -lpthread  -lrt
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;
                }
 
index 3c9e560504436c18f5da48e6623e7ab525317a38..eb4896f20fd2ac26175272079097f4f5df07802e 100644 (file)
@@ -14,6 +14,13 @@ typedef enum {
        FWP_VF_RESCHED          = 4 ,
 } fwp_vres_flag_t;
 
+fwp_vres_params_t fwp_vres_params_default = {
+       .id = 0,        
+       .ac_id = FWP_AC_VO,
+        .budget = 100,
+       .period_usec = 2111111,
+};
+
 /**
  * Structure of FWP vres.
  * Internal representation of vres
index 6638c7d9da3ecc3fff18fcff8cd94a82f6d85dbc..4c795cb0f8abdc8973150efa8444ead1c876a91d 100644 (file)
@@ -52,5 +52,7 @@ int fwp_vres_send(fwp_vres_d_t vresd, struct fwp_msgb* msgb);
 int fwp_vres_bind(fwp_vres_d_t vresd, int sockd);
 int fwp_vres_unbind(fwp_vres_d_t vresd);
 
+extern fwp_vres_params_t fwp_vres_params_default;
+
 #endif /* _FWP_INTERNALS_ */
 #endif /* _FWP_VRES_H */
index 76a6eeb5e3a52826bd4545793a66f1723099e50e..1f80dfa6ab16aca16523e344e95162517d8bb7e6 100644 (file)
@@ -17,7 +17,7 @@ int fwp_fna_send_endpoint_created(fna_endpoint_data_t  *endpoint)
 
        node = (unsigned int) endpoint->destination;
        port = (unsigned int) endpoint->stream_id;
-       attr = (fwp_endpoint_attr_t*) endpoint->protocol_info.body; 
+       attr = (fwp_endpoint_attr_t*) endpoint->endpoint_protocol_info.send.body; 
        rv = fwp_send_endpoint_create(node, port, attr, &fwp_epoint);
        if (rv)
                return rv;
@@ -46,7 +46,7 @@ int fwp_fna_receive_endpoint_created(fna_endpoint_data_t  *endpoint)
 int fwp_fna_send_endpoint_bind(fna_endpoint_data_t *endpoint, fna_vres_id_t vres)
 {
        return fwp_send_endpoint_bind(endpoint->protocol_info.body, 
-                                       (fwp_vres_t*) vres);
+                                       (fwp_endpoint_t*) vres);
 }
 
 int fwp_fna_send_endpoint_unbind(fna_endpoint_data_t *endpoint)