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 */
* \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)
*
* \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)
/**
* 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)
* \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;
/**
* 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;
msgb->socket = &epoint->socket;
msgb->data = msg;
+ /*msgb->flags = epoint->flags;*/
fwp_msgb_put(msgb, size);
/*msgb->tail = msgb->data + size;
msgb->len = size;*/
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);
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;
}