]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
remove flag parameter from fwp ops
authorMartin Molnar <molnar@sum.(none)>
Mon, 11 Feb 2008 15:18:54 +0000 (16:18 +0100)
committerMartin Molnar <molnar@sum.(none)>
Mon, 11 Feb 2008 15:18:54 +0000 (16:18 +0100)
fwp/libfwp/include/fwp_endpoint.h
fwp/libfwp/src/fwp_endpoint.c
fwp/tests/fwp_prototest/fwp_sendrecv_test.c

index eabe12c1ed20ffc7777dc30de6108da0155fcc60..bc30dd844a9a05b6cc16bd67374db9732fd1d516 100644 (file)
@@ -29,23 +29,25 @@ struct fwp_endpoint{
        unsigned int vres_id;
        struct fwp_socket socket;
        int sockd;
+       int flags; /*flags specific operation options*/
        int status;
 };
 
 void fwp_endpoint_table_init();
-int fwp_endpoint_destroy(unsigned int epoint_id);
 inline int fwp_endpoint_is_valid(unsigned int epoint_id);
 inline int fwp_send_endpoint_is(unsigned int epoint_id);
 
 int fwp_send_endpoint_create(unsigned int node, unsigned int port);
 int fwp_receive_endpoint_create(unsigned int port);
+int fwp_endpoint_destroy(unsigned int epoint_id);
 
 int fwp_send_endpoint_bind(unsigned int vres_id, unsigned int epoint_id);
 int fwp_send_endpoint_unbind(unsigned int epoint_id);
-/*int fwp_endpoint_setqpolicy(struct fwp_endpoint *epoint, qpolicy);*/
 
-int fwp_send(unsigned int epoint_id, void *msg, size_t size, int flags);
-ssize_t fwp_recv(unsigned int epoint_id, void *buffer, size_t buffer_size, 
-                int flags);
+/*int fwp_endpoint_setqpolicy(unsigne int epoint_id, qpolicy);*/
+/*int fwp_endpoint_setflags(unsigned int epoint_id, flags);*/
+
+int fwp_send(unsigned int epoint_id, void *msg, size_t size);
+ssize_t fwp_recv(unsigned int epoint_id, void *buffer, size_t buffer_size);
 
 #endif /*_FWP_ENDPOINT_H */ 
index 82e391e372e2d23b02dc2c2ec5894ba49fd30ce2..65a204cd9f26034d1b61735d75752582d01c7970 100644 (file)
@@ -63,7 +63,8 @@ int fwp_endpoint_alloc()
  * \param[in] node IP address of destination node
  * \param[in] port UDP port
  *
- * \return On success returns identifier of endpoint. On error, negative error code is returned. 
+ * \return On success returns identifier of endpoint. 
+ * On error, negative error code is returned. 
  *
  */
 int fwp_send_endpoint_create(unsigned int node, unsigned int port)
@@ -96,7 +97,8 @@ int fwp_send_endpoint_create(unsigned int node, unsigned int port)
  *
  * \param[in] port UDP port
  *
- * \return On success returns 0. On error, negative error code is returned.
+ * \return On success returns identifier of endpoint. 
+ * On error, negative error code is returned.
  *
  */
 int fwp_receive_endpoint_create(unsigned int port)
@@ -128,9 +130,10 @@ int fwp_receive_endpoint_create(unsigned int port)
 /**
  * Destroys endpoint
  *
- * \param[in] epoint Placeholder for the endpoint object
+ * \param[in] epoint_id identifier of endpoint
  *
- * \return On success returns 0. On error, negative error code is returned.
+ * \return On success returns 0. 
+ * On error, negative error code is returned.
  *
  */
 int fwp_endpoint_destroy(unsigned int epoint_id)
@@ -196,22 +199,20 @@ int fwp_send_endpoint_unbind(unsigned int epoint_id)
  * \param[in] epoint_id  identificator of endpoint
  * \param[in] buffer buffer to store message
  * \param[in] buffer_size size of buffer
- * \flags specific receive operation options
  *
  * \return
  * On success, it returns number of received bytes.  
  * On error, negative error code is returned,
  *
  */
-ssize_t fwp_recv(unsigned int epoint_id, void *buffer, size_t buffer_size, 
-                int flags)
+ssize_t fwp_recv(unsigned int epoint_id, void *buffer, size_t buffer_size)
 {
        struct fwp_endpoint *epoint = &fwp_endpoint_table[epoint_id];
        struct fwp_socket *sock = &epoint->socket;
        ssize_t len;
        
-       while ((len = recvfrom(epoint->sockd, buffer, buffer_size, flags, 
-                              (struct sockaddr*)sock->addr, 
+       while ((len = recvfrom(epoint->sockd, buffer, buffer_size, 0 
+                              /*epoint->flags*/, (struct sockaddr*)sock->addr,
                               &sock->addrlen)) < 0) {
 
                if (errno == EINTR) continue;
@@ -226,17 +227,16 @@ ssize_t fwp_recv(unsigned int epoint_id, void *buffer, size_t buffer_size,
 /**
  * Sends message through vres
  *
- * \param epoint_id  identificator of endpoint
- * \param msg message to sent
- * \param size message size
- * \flags specific send operation options
+ * \param[in] epoint_id  identificator of endpoint
+ * \param[in] msg message to sent
+ * \param[in] size message size
  *
  * \return
  * On success, it returns zero.  
  * On error, negative error code is returned,
  *
  */
-int fwp_send(unsigned int epoint_id, void *msg, size_t size, int flags)
+int fwp_send(unsigned int epoint_id, void *msg, size_t size)
 {
        struct fwp_endpoint *epoint = &fwp_endpoint_table[epoint_id];
        struct fwp_msgb *msgb;
@@ -252,6 +252,7 @@ int fwp_send(unsigned int epoint_id, void *msg, size_t size, int flags)
 
                msgb->socket = &epoint->socket;
                msgb->data = msg;
+               /*msgb->flags = epoint->flags;*/
                fwp_msgb_put(msgb, size);
                /*msgb->tail = msgb->data + size;
                msgb->len = size;*/
index bccca13cba2e045b96670971d8233a4130a8bf75..f1e8db252c2318e39fecff002fd9f2deacd8ad93 100644 (file)
@@ -47,13 +47,12 @@ int main()
        if ((repoint_id = fwp_receive_endpoint_create(7777)) < 0){
                return -1;
        }
-               
        printf("Receive endpoint created\n");
+       
        sepoint_id1 = fwp_send_endpoint_create(inet_addr("127.0.0.1"), 7777);
        if (sepoint_id1 < 0){
                return -1;
        }
-
        printf("Send endpoint 1 created\n");
        fwp_send_endpoint_bind(sepoint_id1, vres_id1);
        
@@ -64,12 +63,11 @@ int main()
        printf("Send endpoint 2 created\n");
        fwp_send_endpoint_bind(sepoint_id2, vres_id2);
        
-       fwp_send(sepoint_id1, msg1, sizeof(msg1), 0);
-       fwp_send(sepoint_id2, msg2, sizeof(msg2), 0);
+       fwp_send(sepoint_id1, msg1, sizeof(msg1));
+       fwp_send(sepoint_id2, msg2, sizeof(msg2));
 
        for (i = 0; i < 2; i++) {
-               if ((len = fwp_recv(repoint_id, buffer, sizeof(buffer), 
-                                   0)) < 0) {
+               if ((len = fwp_recv(repoint_id, buffer, sizeof(buffer))) < 0) {
                        perror("Error while receiving data");
                        return -1;
                }