Add a getter for the mem_pool_t base address
authorMartin Willi <martin@revosec.ch>
Fri, 24 Aug 2012 09:07:50 +0000 (09:07 +0000)
committerMartin Willi <martin@revosec.ch>
Fri, 24 Aug 2012 09:19:07 +0000 (11:19 +0200)
src/libhydra/attributes/mem_pool.c
src/libhydra/attributes/mem_pool.h

index f55b3a7..33b116d 100644 (file)
@@ -162,6 +162,12 @@ METHOD(mem_pool_t, get_name, const char*,
        return this->name;
 }
 
+METHOD(mem_pool_t, get_base, host_t*,
+       private_mem_pool_t *this)
+{
+       return this->base;
+}
+
 METHOD(mem_pool_t, get_size, u_int,
        private_mem_pool_t *this)
 {
@@ -463,6 +469,7 @@ mem_pool_t *mem_pool_create(char *name, host_t *base, int bits)
        INIT(this,
                .public = {
                        .get_name = _get_name,
+                       .get_base = _get_base,
                        .get_size = _get_size,
                        .get_online = _get_online,
                        .get_offline = _get_offline,
index bb963de..7b7e58a 100644 (file)
@@ -39,6 +39,13 @@ struct mem_pool_t {
        const char* (*get_name)(mem_pool_t *this);
 
        /**
+        * Get the base (first) address of this pool.
+        *
+        * @return                      base address, internal host
+        */
+       host_t* (*get_base)(mem_pool_t *this);
+
+       /**
         * Get the size (i.e. number of addresses) of this pool.
         *
         * @return                      the size of this pool