]> rtime.felk.cvut.cz Git - frescor/fwp.git/blobdiff - fwp/lib/fwp/fwp_vres.c
Removed "descriptor" types
[frescor/fwp.git] / fwp / lib / fwp / fwp_vres.c
index d81c16a5e80514b3738158bbd9354e6213bbbca5..32a9eff4f0f75ef0e4d91e5b9184d62c69cd1614 100644 (file)
@@ -254,10 +254,8 @@ int fwp_vres_table_init(unsigned int max_vres)
        return 0;
 }
 
-fwp_vres_id_t fwp_vres_get_id(fwp_vres_d_t vresd)
+fwp_vres_id_t fwp_vres_get_id(fwp_vres_t *vres)
 {
-       fwp_vres_t *vres = vresd;
-       
        return (vres - fwp_vres_table.entry);
 }
 
@@ -266,7 +264,7 @@ fwp_vres_id_t fwp_vres_get_id(fwp_vres_d_t vresd)
  *
  * \return On success returns vres descriptor. 
  */
-fwp_vres_d_t fwp_vres_alloc()
+fwp_vres_t *fwp_vres_alloc()
 {
        int i;
        unsigned int max_vres;
@@ -309,17 +307,15 @@ inline int _fwp_vres_set_params(fwp_vres_t *vres, fwp_vres_params_t *params)
 /**
  * Set vres params
  *
- * \param[in] vresdp Vres descriptor
+ * \param[in] vresp Vres descriptor
  * \param[in] params Vres parameters
  *
  * \return On success returns zero. 
  * On error, negative error code is returned. 
  *
  */
-int fwp_vres_set_params(fwp_vres_d_t vresd, fwp_vres_params_t *params)
+int fwp_vres_set_params(fwp_vres_t *vres, fwp_vres_params_t *params)
 {
-       fwp_vres_t *vres = vresd;
-       
        if (!fwp_vres_is_valid(vres)) {
                errno = EINVAL;
                return -1;
@@ -332,13 +328,13 @@ int fwp_vres_set_params(fwp_vres_d_t vresd, fwp_vres_params_t *params)
  * Creates new vres
  *
  * \param[in] params Vres parameters
- * \param[out] vresdp Pointer to the descriptor of newly created vres
+ * \param[out] vresp Pointer to the descriptor of newly created vres
  *
  * \return On success returns descriptor of vres. 
  * On error, negative error code is returned. 
  *
  */
-int fwp_vres_create(fwp_vres_params_t *params, fwp_vres_d_t *vresdp)
+int fwp_vres_create(fwp_vres_params_t *params, fwp_vres_t **vresp)
 {
        int rv;
        fwp_vres_t *vres;
@@ -359,7 +355,7 @@ int fwp_vres_create(fwp_vres_params_t *params, fwp_vres_d_t *vresdp)
                goto err;
        }
 
-       *vresdp = vres;
+       *vresp = vres;
        return 0;
 err:   
        fwp_vres_free(vres);
@@ -369,16 +365,14 @@ err:
 /**
  * Destroys vres
  *
- * \param[in] vresd Vres descriptor
+ * \param[in] vres Vres descriptor
  *
  * \return On success returns 0. 
  * On error, negative error code is returned. 
  *
  */
-int fwp_vres_destroy(fwp_vres_d_t vresd)
+int fwp_vres_destroy(fwp_vres_t *vres)
 {      
-       fwp_vres_t *vres = vresd;
-
        if (!fwp_vres_is_valid(vres)) {
                errno = EINVAL;
                return -1;
@@ -492,10 +486,8 @@ static void* fwp_vres_tx_thread(void *_vres)
        return NULL;
 }
 
-int fwp_vres_send(fwp_vres_d_t vresd, struct fwp_msgb* msgb)
+int fwp_vres_send(fwp_vres_t *vres, struct fwp_msgb* msgb)
 {
-       fwp_vres_t *vres = vresd;
-
        if (fwp_vres_is_valid(vres)) {
                return fwp_msgq_enqueue(&vres->tx_queue, msgb);
        } else {
@@ -504,10 +496,9 @@ int fwp_vres_send(fwp_vres_d_t vresd, struct fwp_msgb* msgb)
        }
 }
 
-/*int fwp_vres_bind(fwp_vres_d_t vresd, fwp_endpoint_t *epoint)*/
-int fwp_vres_bind(fwp_vres_d_t vresd, int sockd)
+/*int fwp_vres_bind(fwp_vres_t *vres, fwp_endpoint_t *epoint)*/
+int fwp_vres_bind(fwp_vres_t *vres, int sockd)
 {
-       fwp_vres_t *vres = vresd;
        int rv = 0;
 
        pthread_mutex_lock(&fwp_vres_table.lock);
@@ -533,11 +524,9 @@ err:
        return rv;
 }
 
-int fwp_vres_unbind(fwp_vres_d_t vresd)
+int fwp_vres_unbind(fwp_vres_t *vres)
 {
-       fwp_vres_t *vres = vresd;
-       
-       if (!fwp_vres_is_valid(vresd)) {
+       if (!fwp_vres_is_valid(vres)) {
                errno = EINVAL;
                return -1;
        }