return (fwp_endpoint_t*) calloc(1,sizeof(fwp_endpoint_t));
}
+/**
+ * Allocates endpoint
+ *
+ * \return On success returns endpoint structure.
+ * On error, NULL is returned.
+ *
+ */
+static inline void fwp_endpoint_free(fwp_endpoint_t *endpoint)
+{
+ free(endpoint);
+}
+
/**
* Destroy endpoint
*
*/
int fwp_endpoint_destroy(fwp_endpoint_d_t epointd)
{
- fwp_endpoint_t *epoint;
-
-/* epoint = (fwp_endpoint_t*) endpoint->endpoint_protocol_info.send.body;
- if (epoint->sockd > 0)
- close(epoint->sockd);*/
+ if (epointd->sockd > 0)
+ close(epointd->sockd);
+ fwp_endpoint_free(epointd);
return 0;
}
*
* \return On success returns 0. On error, -1 and errno is set appropriately.
*/
-int fwp_send_endpoint_bind(fwp_vres_d_t vresd, fwp_endpoint_t *epoint)
+int fwp_send_endpoint_bind(fwp_endpoint_t *epoint, fwp_vres_d_t vresd)
{
int rv ;
fwp_endpoint_t *fwp_epoint = epoint;
* \return On success returns 0. On error, -1 is returned and errno is set appropriately.
*
*/
-int fwp_send_endpoint_unbind(fwp_endpoint_d_t epointd)
+int fwp_send_endpoint_unbind(fwp_endpoint_t *epoint)
{
int rv = 0;
- fwp_endpoint_t *fwp_epoint = epointd;
+ fwp_endpoint_t *fwp_epoint = epoint;
/* unlink epoint-vres mutually */
if ((rv = fwp_vres_unbind(fwp_epoint->vresd)) < 0)
return fwp_init();
}
-int fwp_fna_send_endpoint_create(fna_endpoint_data_t *endpoint)
+int fwp_fna_send_endpoint_created(fna_endpoint_data_t *endpoint)
{
unsigned int node, port;
fwp_endpoint_attr_t *attr;
return 0;
}
-int fwp_fna_recv_endpoint_create(fna_endpoint_data_t *endpoint)
+int fwp_fna_receive_endpoint_created(fna_endpoint_data_t *endpoint)
{
unsigned int node,port;
fwp_endpoint_attr_t *attr;
return 0;
}
-/** FNA send routine */
+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);
+}
+
+int fwp_fna_send_endpoint_unbind(fna_endpoint_data_t *endpoint)
+{
+ return fwp_send_endpoint_unbind(endpoint->protocol_info.body);
+}
+int fwp_fna_endpoint_destroy(fna_endpoint_data_t *endpoint)
+{
+ return fwp_endpoint_destroy(endpoint->endpoint_protocol_info.send.body);
+}
+
+/** FNA send routine */
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.body;
+ fwp_epoint = endpoint->protocol_info.body;
return fwp_send(fwp_epoint, msg, size, flags);
}
fwp_endpoint_t *fwp_epoint;
int flags = 0;
- fwp_epoint = endpoint->endpoint_protocol_info.send.body;
+ fwp_epoint = endpoint->protocol_info.body;
return fwp_send(fwp_epoint, msg, size, flags);
}
{
fwp_endpoint_t *fwp_epoint;
- fwp_epoint = endpoint->endpoint_protocol_info.send.body;
+ fwp_epoint = (fwp_endpoint_t*) endpoint->protocol_info.body;
return fwp_send(fwp_epoint, msg, size, MSG_DONTWAIT);
}
fwp_endpoint_t *fwp_epoint;
int flags = 0;
- fwp_epoint = (fwp_endpoint_t*)
- endpoint->protocol_info.body;
-
+ fwp_epoint = (fwp_endpoint_t*) endpoint->protocol_info.body;
len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
if (len < 0)
return len;
fwp_endpoint_t *fwp_epoint;
int flags = 0;
- fwp_epoint = (fwp_endpoint_t*)
- endpoint->protocol_info.body;
-
+ fwp_epoint = (fwp_endpoint_t*) endpoint->protocol_info.body;
len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
if (len < 0)
return len;
fwp_endpoint_t *fwp_epoint;
int flags = 0;
- fwp_epoint = (fwp_endpoint_t*)
- endpoint->protocol_info.body;
-
+ fwp_epoint = (fwp_endpoint_t*) endpoint->protocol_info.body;
len = fwp_recv(fwp_epoint, buffer, buffer_size, &from_addr, flags);
if (len < 0)
return len;
.fna_receive_sync = fwp_fna_receive_sync,
.fna_receive_async = fwp_fna_receive_async,
.fna_send_endpoint_get_status = NULL,
- .fna_receive_endpoint_created = NULL,
+ .fna_endpoint_destroy = fwp_fna_endpoint_destroy,
+ .fna_send_endpoint_created = fwp_fna_send_endpoint_created,
+ .fna_send_endpoint_bind = fwp_fna_send_endpoint_bind,
+ .fna_send_endpoint_unbind = fwp_fna_send_endpoint_unbind,
+ .fna_receive_endpoint_created = fwp_fna_receive_endpoint_created,
.fna_receive_endpoint_get_status = NULL,
.fna_network_get_max_message_size = NULL,
.fna_network_bytes_to_budget = NULL,