reverting last 2 commits, do it later
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7696 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -172,19 +172,14 @@ hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP,
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
hashtable_rc_t hashtable_dump_content (
|
||||
const hash_table_t * const hashtblP,
|
||||
char * const buffer_pP,
|
||||
int * const remaining_bytes_in_buffer_pP)
|
||||
hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP )
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
hash_node_t *node = NULL;
|
||||
unsigned int i = 0;
|
||||
unsigned int num_elements = 0;
|
||||
int rc;
|
||||
|
||||
if (hashtblP == NULL) {
|
||||
rc = snprintf(
|
||||
*remaining_bytes_in_buffer_pP = snprintf(
|
||||
buffer_pP,
|
||||
*remaining_bytes_in_buffer_pP,
|
||||
"HASH_TABLE_BAD_PARAMETER_HASHTABLE");
|
||||
@@ -194,18 +189,13 @@ hashtable_rc_t hashtable_dump_content (
|
||||
if (hashtblP->nodes[i] != NULL) {
|
||||
node=hashtblP->nodes[i];
|
||||
while(node) {
|
||||
rc = snprintf(
|
||||
buffer_pP,
|
||||
*remaining_bytes_in_buffer_pP,
|
||||
"Key 0x%"PRIx64" Element %p\n",
|
||||
node->key,
|
||||
node->data);
|
||||
*remaining_bytes_in_buffer_pP = snprintf(
|
||||
buffer_pP,
|
||||
*remaining_bytes_in_buffer_pP,
|
||||
"Key 0x%"PRIx64" Element %p\n",
|
||||
node->key,
|
||||
node->data);
|
||||
node=node->next;
|
||||
if ((0 > rc) || (*remaining_bytes_in_buffer_pP < rc)) {
|
||||
fprintf(stderr, "Error while dumping hashtable content");
|
||||
} else {
|
||||
*remaining_bytes_in_buffer_pP -= rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
@@ -252,10 +242,10 @@ hashtable_rc_t hashtable_insert(hash_table_t * const hashtblP, const hash_key_t
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* To free an element from the hash table, we just search for it in the linked list for that hash value,
|
||||
* and free it if it is found. If it was not found, it is an error and -1 is returned.
|
||||
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
|
||||
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
|
||||
*/
|
||||
hashtable_rc_t hashtable_free(hash_table_t * const hashtblP, const hash_key_t keyP)
|
||||
hashtable_rc_t hashtable_remove(hash_table_t * const hashtblP, const hash_key_t keyP)
|
||||
{
|
||||
hash_node_t *node, *prevnode=NULL;
|
||||
hash_size_t hash = 0;
|
||||
@@ -281,36 +271,6 @@ hashtable_rc_t hashtable_free(hash_table_t * const hashtblP, const hash_key_t ke
|
||||
}
|
||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
|
||||
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
|
||||
*/
|
||||
hashtable_rc_t hashtable_remove(hash_table_t * const hashtblP, const hash_key_t keyP, void** dataP)
|
||||
{
|
||||
hash_node_t *node, *prevnode=NULL;
|
||||
hash_size_t hash = 0;
|
||||
|
||||
if (hashtblP == NULL) {
|
||||
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
||||
}
|
||||
hash=hashtblP->hashfunc(keyP)%hashtblP->size;
|
||||
node=hashtblP->nodes[hash];
|
||||
while(node) {
|
||||
if(node->key == keyP) {
|
||||
if(prevnode) prevnode->next=node->next;
|
||||
else hashtblP->nodes[hash]=node->next;
|
||||
*dataP = node->data;
|
||||
free(node);
|
||||
hashtblP->num_elements -= 1;
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
prevnode=node;
|
||||
node=node->next;
|
||||
}
|
||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
|
||||
@@ -348,7 +308,7 @@ hashtable_rc_t hashtable_get(const hash_table_t * const hashtblP, const hash_key
|
||||
* If the number of elements are reduced, the hash table will waste memory. That is why we provide a function for resizing the table.
|
||||
* Resizing a hash table is not as easy as a realloc(). All hash values must be recalculated and each element must be inserted into its new position.
|
||||
* We create a temporary hash_table_t object (newtbl) to be used while building the new hashes.
|
||||
* This allows us to reuse hashtable_insert() and hashtable_free(), when moving the elements to the new table.
|
||||
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
|
||||
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
|
||||
*/
|
||||
|
||||
@@ -372,7 +332,7 @@ hashtable_rc_t hashtable_resize(hash_table_t * const hashtblP, const hash_size_t
|
||||
next = node->next;
|
||||
hashtable_insert(&newtbl, node->key, node->data);
|
||||
// Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
|
||||
hashtable_free(hashtblP, node->key);
|
||||
hashtable_remove(hashtblP, node->key);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,6 @@ typedef enum hashtable_return_code_e {
|
||||
HASH_TABLE_CODE_MAX
|
||||
} hashtable_rc_t;
|
||||
|
||||
#define HASH_TABLE_DEFAULT_HASH_FUNC NULL
|
||||
#define HASH_TABLE_DEFAULT_FREE_FUNC NULL
|
||||
|
||||
|
||||
typedef struct hash_node_s {
|
||||
hash_key_t key;
|
||||
@@ -75,8 +72,7 @@ hashtable_rc_t hashtable_is_key_exists (const hash_table_t * const hashtbl, con
|
||||
hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t * const hashtblP, void funct(hash_key_t keyP, void* dataP, void* parameterP), void* parameterP);
|
||||
hashtable_rc_t hashtable_dump_content (const hash_table_t * const hashtblP, char * const buffer_pP, int * const remaining_bytes_in_buffer_pP );
|
||||
hashtable_rc_t hashtable_insert (hash_table_t * const hashtbl, const hash_key_t key, void *data);
|
||||
hashtable_rc_t hashtable_free (hash_table_t * const hashtbl, const hash_key_t key);
|
||||
hashtable_rc_t hashtable_remove(hash_table_t * const hashtblP, const hash_key_t keyP, void** dataP);
|
||||
hashtable_rc_t hashtable_remove (hash_table_t * const hashtbl, const hash_key_t key);
|
||||
hashtable_rc_t hashtable_get (const hash_table_t * const hashtbl, const hash_key_t key, void **dataP);
|
||||
hashtable_rc_t hashtable_resize (hash_table_t * const hashtbl, const hash_size_t size);
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "obj_hashtable.h"
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
@@ -39,11 +38,11 @@
|
||||
* This is a simple/naive hash function which adds the key's ASCII char values. It will probably generate lots of collisions on large hash tables.
|
||||
*/
|
||||
|
||||
static hash_size_t def_hashfunc(const void * const keyP, int key_sizeP)
|
||||
static hash_size_t def_hashfunc(const void *keyP, int key_sizeP)
|
||||
{
|
||||
hash_size_t hash=0;
|
||||
|
||||
while(key_sizeP) hash^=((unsigned char*)keyP)[--key_sizeP];
|
||||
while(key_sizeP) hash^=((unsigned char*)keyP)[key_sizeP --];
|
||||
|
||||
return hash;
|
||||
}
|
||||
@@ -55,7 +54,7 @@ static hash_size_t def_hashfunc(const void * const keyP, int key_sizeP)
|
||||
* The user can also specify a hash function. If the hashfunc argument is NULL, a default hash function is used.
|
||||
* If an error occurred, NULL is returned. All other values in the returned obj_hash_table_t pointer should be released with hashtable_destroy().
|
||||
*/
|
||||
obj_hash_table_t *obj_hashtable_create(const hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int ), void (*freekeyfuncP)(void*), void (*freedatafuncP)(void*))
|
||||
obj_hash_table_t *obj_hashtable_create(hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int ), void (*freekeyfuncP)(void*), void (*freedatafuncP)(void*))
|
||||
{
|
||||
obj_hash_table_t *hashtbl;
|
||||
|
||||
@@ -84,7 +83,7 @@ obj_hash_table_t *obj_hashtable_create(const hash_size_t sizeP, hash_size_t (*ha
|
||||
* Cleanup
|
||||
* The hashtable_destroy() walks through the linked lists for each possible hash value, and releases the elements. It also releases the nodes array and the obj_hash_table_t.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t * const hashtblP)
|
||||
hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t *hashtblP)
|
||||
{
|
||||
hash_size_t n;
|
||||
obj_hash_node_t *node, *oldnode;
|
||||
@@ -104,7 +103,7 @@ hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t * const hashtblP)
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
hashtable_rc_t obj_hashtable_is_key_exists (const obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP)
|
||||
hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP)
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
obj_hash_node_t *node;
|
||||
@@ -127,55 +126,12 @@ hashtable_rc_t obj_hashtable_is_key_exists (const obj_hash_table_t * const hasht
|
||||
}
|
||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
hashtable_rc_t obj_hashtable_dump_content (
|
||||
const obj_hash_table_t * const hashtblP,
|
||||
char * const buffer_pP,
|
||||
int * const remaining_bytes_in_buffer_pP)
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
obj_hash_node_t *node = NULL;
|
||||
unsigned int i = 0;
|
||||
unsigned int num_elements = 0;
|
||||
int rc;
|
||||
|
||||
if (hashtblP == NULL) {
|
||||
rc = snprintf(
|
||||
buffer_pP,
|
||||
*remaining_bytes_in_buffer_pP,
|
||||
"HASH_TABLE_BAD_PARAMETER_HASHTABLE");
|
||||
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
||||
}
|
||||
while ((i < hashtblP->size) && (*remaining_bytes_in_buffer_pP > 0)) {
|
||||
if (hashtblP->nodes[i] != NULL) {
|
||||
node=hashtblP->nodes[i];
|
||||
while(node) {
|
||||
rc = snprintf(
|
||||
buffer_pP,
|
||||
*remaining_bytes_in_buffer_pP,
|
||||
"Hash 0x%x Key 0x%"PRIx64" Element %p\n",
|
||||
i,
|
||||
node->key,
|
||||
node->data);
|
||||
node=node->next;
|
||||
if ((0 > rc) || (*remaining_bytes_in_buffer_pP < rc)) {
|
||||
fprintf(stderr, "Error while dumping hashtable content");
|
||||
} else {
|
||||
*remaining_bytes_in_buffer_pP -= rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* Adding a new element
|
||||
* To make sure the hash value is not bigger than size, the result of the user provided hash function is used modulo size.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_insert(obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP, void *dataP)
|
||||
hashtable_rc_t obj_hashtable_insert(obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP)
|
||||
{
|
||||
obj_hash_node_t *node;
|
||||
hash_size_t hash;
|
||||
@@ -190,21 +146,15 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t * const hashtblP, const voi
|
||||
if (node->data) {
|
||||
hashtblP->freedatafunc(node->data);
|
||||
}
|
||||
node->data = dataP;
|
||||
node->key_size = key_sizeP;
|
||||
node->data=dataP;
|
||||
// waste of memory here (keyP is lost) we should free it now
|
||||
return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
|
||||
}
|
||||
node=node->next;
|
||||
}
|
||||
if(!(node=malloc(sizeof(obj_hash_node_t)))) return -1;
|
||||
if(!(node->key=malloc(key_sizeP))) {
|
||||
free(node);
|
||||
return -1;
|
||||
}
|
||||
memcpy(node->key, keyP, key_sizeP);
|
||||
node->data = dataP;
|
||||
node->key_size = key_sizeP;
|
||||
node->key=keyP;
|
||||
node->data=dataP;
|
||||
if (hashtblP->nodes[hash]) {
|
||||
node->next=hashtblP->nodes[hash];
|
||||
} else {
|
||||
@@ -212,12 +162,13 @@ hashtable_rc_t obj_hashtable_insert(obj_hash_table_t * const hashtblP, const voi
|
||||
}
|
||||
hashtblP->nodes[hash]=node;
|
||||
return HASH_TABLE_OK;
|
||||
}//-------------------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
|
||||
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_free(obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP)
|
||||
hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP)
|
||||
{
|
||||
obj_hash_node_t *node, *prevnode=NULL;
|
||||
hash_size_t hash;
|
||||
@@ -246,44 +197,11 @@ hashtable_rc_t obj_hashtable_free(obj_hash_table_t * const hashtblP, const void*
|
||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* To remove an element from the hash table, we just search for it in the linked list for that hash value,
|
||||
* and remove it if it is found. If it was not found, it is an error and -1 is returned.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_remove(obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP, void** dataP)
|
||||
{
|
||||
obj_hash_node_t *node, *prevnode=NULL;
|
||||
hash_size_t hash;
|
||||
|
||||
if (hashtblP == NULL) {
|
||||
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
|
||||
}
|
||||
|
||||
hash=hashtblP->hashfunc(keyP, key_sizeP)%hashtblP->size;
|
||||
node=hashtblP->nodes[hash];
|
||||
while(node) {
|
||||
if ((node->key == keyP) || ((node->key_size == key_sizeP) && (memcmp(node->key, keyP, key_sizeP) == 0))){
|
||||
if(prevnode) {
|
||||
prevnode->next=node->next;
|
||||
} else {
|
||||
hashtblP->nodes[hash]=node->next;
|
||||
}
|
||||
hashtblP->freekeyfunc(node->key);
|
||||
*dataP = node->data;
|
||||
free(node);
|
||||
return HASH_TABLE_OK;
|
||||
}
|
||||
prevnode=node;
|
||||
node=node->next;
|
||||
}
|
||||
return HASH_TABLE_KEY_NOT_EXISTS;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
* Searching for an element is easy. We just search through the linked list for the corresponding hash value.
|
||||
* NULL is returned if we didn't find it.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_get(const obj_hash_table_t *const hashtblP, const void* const keyP, const int key_sizeP, void** dataP)
|
||||
hashtable_rc_t obj_hashtable_get(obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void** dataP)
|
||||
{
|
||||
obj_hash_node_t *node;
|
||||
hash_size_t hash;
|
||||
@@ -313,7 +231,7 @@ hashtable_rc_t obj_hashtable_get(const obj_hash_table_t *const hashtblP, const v
|
||||
/*
|
||||
* Function to return all keys of an object hash table
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_get_keys(const obj_hash_table_t * const hashtblP, void ** keysP, unsigned int * sizeP)
|
||||
hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP)
|
||||
{
|
||||
size_t n = 0;
|
||||
obj_hash_node_t *node = NULL;
|
||||
@@ -340,10 +258,10 @@ hashtable_rc_t obj_hashtable_get_keys(const obj_hash_table_t * const hashtblP, v
|
||||
* If the number of elements are reduced, the hash table will waste memory. That is why we provide a function for resizing the table.
|
||||
* Resizing a hash table is not as easy as a realloc(). All hash values must be recalculated and each element must be inserted into its new position.
|
||||
* We create a temporary obj_hash_table_t object (newtbl) to be used while building the new hashes.
|
||||
* This allows us to reuse hashtable_insert() and hashtable_free(), when moving the elements to the new table.
|
||||
* This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
|
||||
* After that, we can just free the old table and copy the elements from newtbl to hashtbl.
|
||||
*/
|
||||
hashtable_rc_t obj_hashtable_resize(obj_hash_table_t * const hashtblP, const hash_size_t sizeP)
|
||||
hashtable_rc_t obj_hashtable_resize(obj_hash_table_t *hashtblP, hash_size_t sizeP)
|
||||
{
|
||||
obj_hash_table_t newtbl;
|
||||
hash_size_t n;
|
||||
@@ -362,7 +280,7 @@ hashtable_rc_t obj_hashtable_resize(obj_hash_table_t * const hashtblP, const has
|
||||
for(node=hashtblP->nodes[n]; node; node=next) {
|
||||
next = node->next;
|
||||
obj_hashtable_insert(&newtbl, node->key, node->key_size, node->data);
|
||||
obj_hashtable_free(hashtblP, node->key, node->key_size);
|
||||
obj_hashtable_remove(hashtblP, node->key, node->key_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,14 @@ typedef struct obj_hash_table_s {
|
||||
void (*freedatafunc)(void*);
|
||||
} obj_hash_table_t;
|
||||
|
||||
obj_hash_table_t *obj_hashtable_create (const hash_size_t size, hash_size_t (*hashfunc)(const void*, int ), void (*freekeyfunc)(void*), void (*freedatafunc)(void*));
|
||||
hashtable_rc_t obj_hashtable_destroy (obj_hash_table_t * const hashtblP);
|
||||
hashtable_rc_t obj_hashtable_is_key_exists (const obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP);
|
||||
hashtable_rc_t obj_hashtable_insert (obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP, void *dataP);
|
||||
hashtable_rc_t obj_hashtable_dump_content (const obj_hash_table_t * const hashtblP,char * const buffer_pP,int * const remaining_bytes_in_buffer_pP);
|
||||
hashtable_rc_t obj_hashtable_free (obj_hash_table_t *hashtblP, const void* keyP, const int key_sizeP);
|
||||
hashtable_rc_t obj_hashtable_remove(obj_hash_table_t *hashtblP, const void* keyP, const int key_sizeP, void** dataP);
|
||||
hashtable_rc_t obj_hashtable_get (const obj_hash_table_t * const hashtblP, const void* const keyP, const int key_sizeP, void ** dataP);
|
||||
hashtable_rc_t obj_hashtable_get_keys(const obj_hash_table_t * const hashtblP, void ** keysP, unsigned int * sizeP);
|
||||
hashtable_rc_t obj_hashtable_resize (obj_hash_table_t * const hashtblP, const hash_size_t sizeP);
|
||||
obj_hash_table_t *obj_hashtable_create (hash_size_t size, hash_size_t (*hashfunc)(const void*, int ), void (*freekeyfunc)(void*), void (*freedatafunc)(void*));
|
||||
hashtable_rc_t obj_hashtable_destroy (obj_hash_table_t *hashtblP);
|
||||
hashtable_rc_t obj_hashtable_is_key_exists (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP);
|
||||
hashtable_rc_t obj_hashtable_insert (obj_hash_table_t *hashtblP, void* keyP, int key_sizeP, void *dataP);
|
||||
hashtable_rc_t obj_hashtable_remove (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP);
|
||||
hashtable_rc_t obj_hashtable_get (obj_hash_table_t *hashtblP, const void* keyP, int key_sizeP, void ** dataP);
|
||||
hashtable_rc_t obj_hashtable_get_keys(obj_hash_table_t *hashtblP, void ** keysP, unsigned int *sizeP);
|
||||
hashtable_rc_t obj_hashtable_resize (obj_hash_table_t *hashtblP, hash_size_t sizeP);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ int sgw_lite_cm_remove_s11_tunnel(Teid_t local_teid)
|
||||
{
|
||||
int temp;
|
||||
|
||||
temp = hashtable_free(sgw_app.s11teid2mme_hashtable, local_teid);
|
||||
temp = hashtable_remove(sgw_app.s11teid2mme_hashtable, local_teid);
|
||||
|
||||
return temp;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ s_plus_p_gw_eps_bearer_context_information_t * sgw_lite_cm_create_bearer_context
|
||||
int sgw_lite_cm_remove_bearer_context_information(Teid_t teid)
|
||||
{
|
||||
int temp;
|
||||
temp = hashtable_free(sgw_app.s11_bearer_context_information_hashtable, teid);
|
||||
temp = hashtable_remove(sgw_app.s11_bearer_context_information_hashtable, teid);
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ int sgw_lite_cm_remove_eps_bearer_entry(hash_table_t *eps_bearersP, ebi_t eps_be
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp = hashtable_free(eps_bearersP, eps_bearer_idP);
|
||||
temp = hashtable_remove(eps_bearersP, eps_bearer_idP);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -1178,26 +1178,7 @@ sgw_lite_handle_delete_session_request(
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback of hashtable_apply_funct_on_elements()
|
||||
*/
|
||||
static void sgw_lite_release_all_enb_related_information(hash_key_t keyP, void* dataP, void* parameterP)
|
||||
{
|
||||
sgw_eps_bearer_entry_t *eps_bearer_entry_p = (sgw_eps_bearer_entry_t*)dataP;
|
||||
if (NULL != eps_bearer_entry_p) {
|
||||
memset(&eps_bearer_entry_p->enb_ip_address_for_S1u,0, sizeof(eps_bearer_entry_p->enb_ip_address_for_S1u));
|
||||
eps_bearer_entry_p->enb_teid_for_S1u = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* From GPP TS 23.401 version 11.11.0 Release 11, section 5.3.5 S1 release procedure:
|
||||
* The S-GW releases all eNodeB related information (address and TEIDs) for the UE and responds with a Release
|
||||
* Access Bearers Response message to the MME. Other elements of the UE's S-GW context are not affected. The
|
||||
* S-GW retains the S1-U configuration that the S-GW allocated for the UE's bearers. The S-GW starts buffering
|
||||
* downlink packets received for the UE and initiating the "Network Triggered Service Request" procedure,
|
||||
* described in clause 5.3.4.3, if downlink packets arrive for the UE.
|
||||
*/
|
||||
int
|
||||
sgw_lite_handle_release_access_bearers_request(
|
||||
const SgwReleaseAccessBearersRequest * const release_access_bearers_req_pP)
|
||||
@@ -1230,14 +1211,7 @@ sgw_lite_handle_release_access_bearers_request(
|
||||
release_access_bearers_resp_p->cause = REQUEST_ACCEPTED;
|
||||
release_access_bearers_resp_p->teid = ctx_p->sgw_eps_bearer_context_information.mme_teid_for_S11;
|
||||
|
||||
|
||||
#warning "TODO Here the release (sgw_lite_handle_release_access_bearers_request)"
|
||||
hash_rc = hashtable_apply_funct_on_elements(ctx_p->sgw_eps_bearer_context_information.pdn_connection.sgw_eps_bearers,
|
||||
sgw_lite_release_all_enb_related_information,
|
||||
NULL);
|
||||
|
||||
// TODO The S-GW starts buffering downlink packets received for the UE
|
||||
// (set target on GTPUSP to order the buffering)
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_SP_GWAPP_MME,
|
||||
|
||||
Reference in New Issue
Block a user