]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
FWP_FNA compilation fixes
authorMartin <molnam1@fel.cvut.cz>
Tue, 7 Oct 2008 14:17:47 +0000 (16:17 +0200)
committerMartin <molnam1@fel.cvut.cz>
Tue, 7 Oct 2008 14:17:47 +0000 (16:17 +0200)
fwp/lib/Makefile.omk
fwp/lib/core/fwp_endpoint.c
fwp/lib/core/fwp_endpoint.h
fwp/lib/fwp.c
fwp/lib/fwp.h
fwp/lib/fwp_fna.c

index f85b03636d1067c1c5c5a2dfe9358ce56056f135..0e0be1095e9884f642bfde330b8a94c99be42107 100644 (file)
@@ -1,10 +1,10 @@
 lib_LIBRARIES = fwp
 CFLAGS += -D_FWP_INTERNALS_
-SUBDIRS = core mngt  
+SUBDIRS = core  
 #LDFLAGS = -lpthread  -lrt
 fwp_SOURCES = core/fwp_util.c core/fwp_vres.c core/fwp_msgb.c core/fwp_msgq.c\
              core/fwp_endpoint.c
-fwp_SOURCES += mngt/fwp_msg.c mngt/fwp_contract.c mngt/fwp_contract_table.c\
+#fwp_SOURCES += mngt/fwp_msg.c mngt/fwp_contract.c mngt/fwp_contract_table.c\
                mngt/fwp_mngt.c
 fwp_SOURCES += fwp.c fwp_fna.c
 
index 9914dd66e40a4aef6f887902d08ed2bf2dcc7d39..3598cd42967ae1aae55fb036962daa9cea0d2700 100644 (file)
@@ -112,7 +112,7 @@ int fwp_endpoint_attr_init(fwp_endpoint_attr_t *attr)
 int fwp_send_endpoint_create(unsigned int node,
                                unsigned int port, 
                                fwp_endpoint_attr_t *attr,
-                               fwp_endpoint_d_t *epointdp)
+                               fwp_endpoint_t **epoint)
 {      
        struct sockaddr_in *addr;
        fwp_endpoint_t *fwp_epoint;
@@ -168,7 +168,7 @@ int fwp_send_endpoint_create(unsigned int node,
        }
        
        FWP_DEBUG("FWP Send endpoint created.\n"); 
-       *epointdp = fwp_epoint;
+       *epoint = fwp_epoint;
        return 0;               
 err:
        fwp_endpoint_destroy(fwp_epoint);
@@ -186,7 +186,7 @@ err:
  */
 int fwp_receive_endpoint_create(unsigned int port,
                                fwp_endpoint_attr_t *attr,
-                               fwp_endpoint_d_t *epointdp)
+                               fwp_endpoint_t **epoint)
 {
        struct sockaddr_in *addr;
        fwp_endpoint_t *fwp_epoint;
@@ -276,7 +276,7 @@ int fwp_receive_endpoint_create(unsigned int port,
                        &fwp_epoint->peer.addrlen);
        
        FWP_DEBUG("Receive endpoint port=%d created.\n", fwp_epoint->port); 
-       *epointdp = fwp_epoint; 
+       *epoint = fwp_epoint;   
        return 0;
 err:
        fwp_endpoint_destroy(fwp_epoint);
@@ -291,10 +291,10 @@ err:
  *
  * \return On success returns 0. On error, -1 and errno is set appropriately.
  */
-int fwp_send_endpoint_bind(fwp_endpoint_d_t epointd, fwp_vres_d_t vresd)
+int fwp_send_endpoint_bind(fwp_endpoint_t *epoint, fwp_vres_d_t vresd)
 {
        int rv ;
-       fwp_endpoint_t *fwp_epoint;
+       fwp_endpoint_t *fwp_epoint = epoint;
        
        rv = _fwp_vres_bind(vresd, fwp_epoint->sockd);
        /* if send endpoint is already bound 
@@ -411,12 +411,12 @@ int fwp_recv_conn(fwp_endpoint_d_t epointd, void *buffer,
  */
 ssize_t fwp_recv(fwp_endpoint_t *endpoint,
                        void *buffer, const size_t buffer_size,
-                       unsigned int *from)
+                       unsigned int *from, int flags)
 {
        fwp_sockaddr_t *peer = &endpoint->peer;
        ssize_t len;
        fd_set fdset;
-       fwp_endpoint_t *fwp_epoint;
+       fwp_endpoint_t *fwp_epoint = endpoint;
        
 /*     if (!fwp_endpoint_is_valid(epointd)) {
                errno = EINVAL;
@@ -464,7 +464,7 @@ ssize_t fwp_recv(fwp_endpoint_t *endpoint,
  * On error, -1 is returned and errno is set appropriately.
  *
  */
-int fwp_send(fwp_endpoint_t *fwp_epoint, void *msg, size_t size, int flags)
+int fwp_send(fwp_endpoint_t *fwp_epoint,const void *msg, const size_t size, int flags)
 {
        struct fwp_msgb *msgb;
        /*fwp_endpoint_t *fwp_epoint;*/
index c85fe8abb0d034b8dd8ef4994786e4992528573e..855fa0e09229031db531134aabe34ecff9f6fb33 100644 (file)
@@ -31,10 +31,10 @@ int fwp_endpoint_get_params(fwp_endpoint_d_t epointd, unsigned int *node,
                                unsigned int *port, fwp_endpoint_attr_t *attr);
 int fwp_send_endpoint_create(unsigned int node, unsigned int port,
                                fwp_endpoint_attr_t *attr, 
-                               fwp_endpoint_d_t *epointdp);
+                               fwp_endpoint_t **epoint);
 int fwp_receive_endpoint_create(/*unsigned int node,*/ unsigned int port,
                                fwp_endpoint_attr_t *attr, 
-                               fwp_endpoint_d_t *epointdp);
+                               fwp_endpoint_t **epoint);
 int fwp_endpoint_destroy(fwp_endpoint_d_t epointd);
 
 int fwp_send_endpoint_bind(fwp_endpoint_d_t epointd, fwp_vres_d_t vresd);
@@ -42,8 +42,8 @@ int fwp_send_endpoint_unbind(fwp_endpoint_d_t epointd);
 
 ssize_t fwp_recv(fwp_endpoint_t *endpoint,
                        void *buffer, const size_t buffer_size,
-                       unsigned int *from);
-int fwp_send(fwp_endpoint_t *fwp_epoint, void *msg, size_t size, int flags);
+                       unsigned int *from, int flags);
+int fwp_send(fwp_endpoint_t *fwp_epoint, const void *msg, const size_t size, int flags);
 
 int fwp_endpoint_attr_init(fwp_endpoint_attr_t *attr);
 
index 1ead872b2ef3b49c8014c9b414e568b7e0a73506..3ee6a02892aa7dc417bc9ea45cf891bada9c91ae 100644 (file)
@@ -1,6 +1,8 @@
 #include "fwp_conf.h"
-#include "fwp_contract.h"
-#include "fwp_mngt.h"
+#include "fwp_vres.h"
+#include "fwp_util.h"
+//#include "fwp_contract.h"
+//#include "fwp_mngt.h"
 
 /*static struct frsh_resource_t fwp_resource = {
        .contract_ops = &fwp_contract_ops; 
@@ -11,31 +13,32 @@ int fwp_init()
 {
        int rv;
 
-       if ((rv = fwp_endpoint_table_init(fwp_configuration.max_endpoints)) ||
-           (rv = fwp_vres_table_init(fwp_configuration.max_vres)))
+       if (/*(rv = fwp_endpoint_table_init(fwp_configuration.max_endpoints))||
+           (rv = fwp_vres_table_init(fwp_configuration.max_vres)))*/
+           (rv = fwp_vres_table_init(20)))
                return rv;
        
-       if (fwp_configuration.mngt) { 
+/*     if (fwp_configuration.mngt) { 
                //frsh_resource_register(FRSH_WIFI, &fwp_resource);
                rv = fwp_mngt_init(); 
                return rv;
-       }
+       }*/
 
        return 0;
 }
 
 int fwp_done()
 {
-       int rv;
+       /*int rv;*/
        
        FWP_DEBUG("FWP done\n");
        /* TODO: Cancel all contracts */
-       if (fwp_configuration.mngt) { 
+       /*if (fwp_configuration.mngt) { 
                //frsh_resource_register(FRSH_WIFI, &fwp_resource);
                FWP_DEBUG("Calling disconnect\n");
                rv = fwp_mngt_disconnect(); 
                return rv;
-       }
+       }*/
        
        return 0;
 }
index 6409860fe6fa75edf26ad959fd4d082c668d6d5b..bb4bd720512b6a704100042ce00885a57b8c73be 100644 (file)
@@ -2,15 +2,15 @@
 #define _FWP_H
 
 #ifndef _FWP_CONFDEFS_H
-#error fwp_confdefs.h not included
+//#error fwp_confdefs.h not included
 #endif
 
 
 #include "fwp_conf.h"
 #include "fwp_vres.h"
 #include "fwp_endpoint.h"
-#include "fwp_contract.h"
-#include "fwp_mngt.h"
+//#include "fwp_contract.h"
+//#include "fwp_mngt.h"
 
 int fwp_init(void);
 int fwp_done(void);
index f31d0f0cd5714c500a90fc557e6c16af726d03af..4da9c38a9bb014d5230bf9cc5456b967acba8512 100644 (file)
@@ -1,41 +1,44 @@
 #include <fna.h>
+#include "fwp_endpoint.h"
 #include "fwp_vres.h"
+#include "fwp.h"
 
-int fwp_fna_init(const frsh_resource_id_t resource_id);
+int fwp_fna_init(const frsh_resource_id_t resource_id)
 {
        return fwp_init();
 }
 
 int fwp_fna_send_endpoint_create(fna_endpoint_data_t  *endpoint)
 {
-       unsigned int node;
-       unsigned int port;
+       unsigned int node, port;
        fwp_endpoint_attr_t *attr;
        fwp_endpoint_t *fwp_epoint;
+       int rv;
 
-       node = (unsigned int) destination;
-       port = (unsigned int) port;
-       attr = (fwp_endpoint_attr*) endpoint->protocol_info.body; 
-       rv = fwp_send_endpoint_create(node, port, attr, fwp_epoint);
+       node = (unsigned int) endpoint->destination;
+       port = (unsigned int) endpoint->stream_id;
+       attr = (fwp_endpoint_attr_t*) endpoint->protocol_info.body; 
+       rv = fwp_send_endpoint_create(node, port, attr, &fwp_epoint);
        if (rv)
                return rv;
-       endpoint->endpoint_protocol_info.send = fwp_epoint;
+       endpoint->endpoint_protocol_info.send.body = fwp_epoint;
        return 0;
 }
 
 int fwp_fna_recv_endpoint_create(fna_endpoint_data_t  *endpoint)
 {
-       unsigned int port;
+       unsigned int node,port;
        fwp_endpoint_attr_t *attr;
        fwp_endpoint_t *fwp_epoint;
+       int rv;
 
-       node = (unsigned int) destination;
-       port = (unsigned int) port;
-       attr = (fwp_endpoint_attr*) endpoint->protocol_info.body; 
-       rv = fwp_receive_endpoint_create(port, attr, fwp_epoint);
+       node = (unsigned int) endpoint->destination;
+       port = (unsigned int) endpoint->stream_id;
+       attr = (fwp_endpoint_attr_t*) endpoint->protocol_info.body; 
+       rv = fwp_receive_endpoint_create(port, attr, &fwp_epoint);
        if (rv)
                return rv;
-       endpoint->endpoint_protocol_info.receive = fwp_epoint;
+       endpoint->endpoint_protocol_info.receive.body = fwp_epoint;
        return 0;
 }
 
@@ -45,28 +48,29 @@ int fwp_fna_send(const fna_endpoint_data_t *endpoint,const void *msg,
                        const size_t size)
 {
        fwp_endpoint_t *fwp_epoint;
+       int flags = 0;
 
-       fwp_epoint = endpoint->endpoint_protocol_info.send;
+       fwp_epoint = endpoint->endpoint_protocol_info.send.body;
        return fwp_send(fwp_epoint, msg, size, flags);
 }
 
-int fwp_fna_send_sync(const fna_endpoint_data_t *endpoint,const void *msg,
-                  const size_t size)
+int fwp_fna_send_sync(const fna_endpoint_data_t *endpoint,const void *msg, 
+                       const size_t size)
 {
        fwp_endpoint_t *fwp_epoint;
+       int flags = 0;
 
-       fwp_epoint = endpoint->endpoint_protocol_info.send;
-       return fwp_send(fwp_epoint, msg, size, 0);
-{
-
+       fwp_epoint = endpoint->endpoint_protocol_info.send.body;
+       return fwp_send(fwp_epoint, msg, size, flags);
+}
 
 int fwp_fna_send_async(const fna_endpoint_data_t *endpoint,const void *msg,
                   const size_t size)
 {
        fwp_endpoint_t *fwp_epoint;
 
-       fwp_epoint = endpoint->endpoint_protocol_info.send;
-       return fwp_fna_send(endpoint, msg, size, MSG_DONTWAIT)
+       fwp_epoint = endpoint->endpoint_protocol_info.send.body;
+       return fwp_send(fwp_epoint, msg, size, MSG_DONTWAIT);
 }
 
 /** FNA receive routines */
@@ -77,11 +81,12 @@ int fwp_fna_receive(const fna_endpoint_data_t *endpoint,
        unsigned int from_addr;
        size_t len;
        fwp_endpoint_t *fwp_epoint;
+       int flags = 0;
        
        fwp_epoint = (fwp_endpoint_t*) 
-                       epointd->endpoint_protocol_info.receive;
+                       endpoint->endpoint_protocol_info.receive.body;
 
-       len = fwp_recv(fwp_epoint, buffer, buffer_size, flags, &from_addr);
+       len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
        if (len < 0) 
                return len;
        
@@ -98,11 +103,12 @@ int fwp_fna_receive_sync(const fna_endpoint_data_t *endpoint, void *buffer,
        unsigned int from_addr;
        size_t len;
        fwp_endpoint_t *fwp_epoint;
+       int flags = 0;
        
        fwp_epoint = (fwp_endpoint_t*) 
-                       epointd->endpoint_protocol_info.receive;
+                       endpoint->endpoint_protocol_info.receive.body;
 
-       len = fwp_recv(fwp_epoint, buffer, buffer_size, flags, &from_addr);
+       len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
        if (len < 0) 
                return len;
        
@@ -119,11 +125,12 @@ int fwp_fna_receive_async(const fna_endpoint_data_t *endpoint, void *buffer,
        unsigned int from_addr;
        size_t len;
        fwp_endpoint_t *fwp_epoint;
+       int flags = 0;
        
        fwp_epoint = (fwp_endpoint_t*) 
-                       epointd->endpoint_protocol_info.receive;
+                       endpoint->endpoint_protocol_info.receive.body;
 
-       len = fwp_recv(fwp_epoint, buffer, buffer_size, flags, &from_addr);
+       len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
        if (len < 0) 
                return len;
        
@@ -137,9 +144,10 @@ int fwp_fna_vres_destroy(const frsh_resource_id_t resource_id,
                     const fna_vres_id_t vres)
 {
 //     return fwp_vres_close(vres);    
+       return 0;
 }
 
-fna_operations_t fwp_fna_operations = {
+/*fna_operations_t fwp_fna_operations = {
     .fna_init = fwp_fna_init,
     .fna_contract_negotiate = NULL,
     .fna_contract_renegotiate_sync = NULL,
@@ -164,4 +172,5 @@ fna_operations_t fwp_fna_operations = {
     .fna_network_bytes_to_budget = NULL,
     .fna_network_budget_to_bytes = NULL,
     .fna_network_get_min_eff_budget = NULL
-}
+};*/
+