Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
f2f0e68f
Commit
f2f0e68f
authored
9 years ago
by
Navid Nikaein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the bug in the RB tree, and sanity test for the timer API
parent
f7d591f1
Branches unavailable
2025.w14
2025.w13
2025.w12
2025.w11
2025.w10
2025.w09
2025.w08
2025.w07
2025.w06
2025.w05
2025.w04
2025.w03
2025.w02
2024.w51
2024.w50
2024.w49
2024.w48
2024.w47
2024.w46
2024.w45
2024.w44
2024.w43
2024.w42
2024.w41
2024.w40
2024.w39
2024.w38
2024.w36
2024.w35
2024.w34
2024.w33
2024.w32
2024.w31
2024.w30
2024.w29
2024.w28
2024.w27
2024.w26
2024.w25
2024.w24
2024.w23
2024.w22
2024.w21
2024.w18
2024.w17
2024.w16
2024.w15
2024.w14
2024.w13
2024.w12
2024.w11
2024.w10
2024.w09
2024.w08
2024.w06
2024.w05
2024.w04
2024.w03
2024.w02
2024.w01
2023.w51
2023.w50
2023.w49
2023.w48
2023.w47
2023.w45
2023.w43
2023.w42
2023.w41
2023.w40
2023.w39
2023.w38
2023.w37
2023.w36
2023.w34
2023.w33
2023.w32
2023.w31
2023.w30
2023.w29
2023.w28
2023.w27
2023.w26
2023.w25
2023.w24
2023.w23
2023.w22
2023.w21
2023.w20
2023.w19
2023.w18
2023.w18b
2023.w16
2023.w15
2023.w14
2023.w13
2023.w12
2023.w11
2023.w11b
2023.w10
2023.w10b
2023.w09
2023.w08
2023.w08b
2023.w07
2023.w06
2023.w05
2023.w03
2023.w02
2022.42
2022.41
2022.w51
2022.w50
2022.w49
2022.w48
2022.w47
2022.w46
2022.w45
2022.w43
2022.w42
2022.w42b
2022.w41
2022.w40
2022.w39
2022.w38
2022.w37
2022.w37b
2022.w36
2022.w35
2022.w33
2022.w32
2022.w31
2022.w31b
2022.w30
2022.w29
2022.w26
2022.w25
2022.w24
2022.w24b
2022.w23
2022.w22
2022.w21
2022.w20
2022.w19
2022.w18
2022.w17
2022.w15
2022.w15b
2022.w14a
2022.w13
2022.w13b
2022.w13a
2022.w12
2022.w10
2022.w09
2022.w09b
2022.w08
2022.w08b
2022.w07
2022.w07b
2022.w06
2022.w06a
2022.w05
2022.w05b
2022.w03_hotfix
2022.w03_b
2022.w02
2022.w01
2021.wk46
2021.wk14_a
2021.wk13_d
2021.wk13_c
2021.w51_c
2021.w51_a
2021.w50_a
2021.w49_b
2021.w49_a
2021.w48
2021.w47
2021.w46
2021.w46-powder
2021.w45
2021.w45_b
2021.w44
2021.w43
2021.w42
2021.w37
2021.w36
2021.w35
2021.w34
2021.w33
2021.w32
2021.w31
2021.w30
2021.w29
2021.w28
2021.w27
2021.w26
2021.w25
2021.w24
2021.w23
2021.w22
2021.w20
2021.w19
2021.w18_b
2021.w18_a
2021.w17_b
2021.w16
2021.w15
2021.w14
2021.w13_a
2021.w12
2021.w11
2021.w10
2021.w09
2021.w08
2021.w06
2021.w05
2021.w04
2021.w02
2020.w51_2
2020.w51
2020.w50
2020.w49
2020.w48_2
2020.w48
2020.w47
2020.w46_2
2020.w46
2020.w45_2
2020.w45
2020.w44
2020.w42_2
2020.w42
2020.w41
2020.w39
2020.w38
2020.w37
2020.w36
2020.w34
2020.w33
2020.w31
2020.w30
2020.w29
2020.w28
2020.w26
2020.w25
2020.w24
2020.w23
2020.w22
2020.w19
2020.w17
2020.w16
2020.w15
2020.w11
2020.w09
2020.w06
2020.w05
2020.w04
2020.w03
2019.w51
2019.w44
2019.w41
2019.w36
2019.w30
2019.w28
2019.w27
2019.w25
2019.w23
2019.w21
2019.w17
2019.w15
2019.w13
2019.w11
2019.w10
2019.w09
2019.w08
2019.w07
2019.w06
2019.w04
2019.w03
2018.w51
2018.w48
2018.w47
2018.w46
2018.w44
2018.w41
2018.w40
2018.w39
2018.w36
2018.w33
2018.w31
2018.w29
2018.w25
2018.w19
2018.w15
2018.w12
2018.w11
2018.w10
2018.w09
2018.w08
2018.w07
2018.w06
2018.w05
2018.w04
2018.w03
2018.w02
2017.w48
2017.w46
2017.w43
2017.w42
2017.w34
2017.w30
2017.w25
2017.w24
2017.w22
2017.w20
2017.w19
2017.w15
2017.w14
2017.w13
2017.w12
2017.w11
2017.w10
2017.w09
2017.w08
2017.w07
2017.w06
2017.w05
2017.w04
2017.w03
2017.w02
2017.w01
2016.w50
2016.w49
v2.2.0
v2.1.0
v2.0.0
v1.2.2
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.3
v1.0.2
v1.0.1
v1.0.0
v0.6.1
v0.6.1_tdd
v0.6
v0.5.1_tdd
setparam
osa-etsi-ws-ue
osa-etsi-ws-try2
osa-etsi-ws-try1
osa-etsi-ws-gNB
oai_nr_sync
nr-ip-over-lte
nr-ip-over-lte-v.1.5
nr-ip-over-lte-v.1.4
nr-ip-over-lte-v.1.3
nr-ip-over-lte-v.1.2
nr-ip-over-lte-v.1.1
nr-ip-over-lte-v.1.0
flexran-eol
develop-nr-pdcch
develop-nr-2020w03
develop-nr-2020w02
develop-nr-2019w51
develop-nr-2019w50
develop-nr-2019w48
develop-nr-2019w47
develop-nr-2019w45
develop-nr-2019w43
develop-nr-2019w42
develop-nr-2019w40
develop-nr-2019w28
develop-nr-2019w23
benetel_phase_rotation
benetel_gnb_rel_2.0
benetel_gnb_rel_1.0
benetel_enb_rel_2.0
benetel_enb_rel_1.0
ARC_1.3
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
233 additions
and
117 deletions
+233
-117
common/utils/collection/tree.h
common/utils/collection/tree.h
+177
-54
common/utils/itti/timer.c
common/utils/itti/timer.c
+1
-7
openair2/ENB_APP/enb_agent.c
openair2/ENB_APP/enb_agent.c
+4
-1
openair2/ENB_APP/enb_agent_common.c
openair2/ENB_APP/enb_agent_common.c
+40
-47
openair2/ENB_APP/enb_agent_common.h
openair2/ENB_APP/enb_agent_common.h
+6
-3
openair2/ENB_APP/enb_agent_handler.c
openair2/ENB_APP/enb_agent_handler.c
+5
-5
No files found.
common/utils/collection/tree.h
View file @
f2f0e68f
/*
/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */
/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */
/* $FreeBSD$ */
/*-
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
* All rights reserved.
*
*
...
@@ -26,6 +30,8 @@
...
@@ -26,6 +30,8 @@
#ifndef _SYS_TREE_H_
#ifndef _SYS_TREE_H_
#define _SYS_TREE_H_
#define _SYS_TREE_H_
#include <sys/cdefs.h>
/*
/*
* This file defines data structures for different types of trees:
* This file defines data structures for different types of trees:
* splay trees and red-black trees.
* splay trees and red-black trees.
...
@@ -63,7 +69,7 @@ struct name { \
...
@@ -63,7 +69,7 @@ struct name { \
#define SPLAY_INIT(root) do { \
#define SPLAY_INIT(root) do { \
(root)->sph_root = NULL; \
(root)->sph_root = NULL; \
} while (0)
} while (
/*CONSTCOND*/
0)
#define SPLAY_ENTRY(type) \
#define SPLAY_ENTRY(type) \
struct { \
struct { \
...
@@ -81,32 +87,32 @@ struct { \
...
@@ -81,32 +87,32 @@ struct { \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
(head)->sph_root = tmp; \
} while (0)
} while (
/*CONSTCOND*/
0)
#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
(head)->sph_root = tmp; \
} while (0)
} while (
/*CONSTCOND*/
0)
#define SPLAY_LINKLEFT(head, tmp, field) do { \
#define SPLAY_LINKLEFT(head, tmp, field) do { \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
SPLAY_LEFT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
(head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
} while (0)
} while (
/*CONSTCOND*/
0)
#define SPLAY_LINKRIGHT(head, tmp, field) do { \
#define SPLAY_LINKRIGHT(head, tmp, field) do { \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
} while (0)
} while (
/*CONSTCOND*/
0)
#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
} while (0)
} while (
/*CONSTCOND*/
0)
/* Generates prototypes and inline functions */
/* Generates prototypes and inline functions */
...
@@ -207,7 +213,7 @@ name##_SPLAY(struct name *head, struct type *elm) \
...
@@ -207,7 +213,7 @@ name##_SPLAY(struct name *head, struct type *elm) \
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
__left = __right = &__node; \
\
\
while ((__comp = (cmp)(elm, (head)->sph_root))) { \
while ((__comp = (cmp)(elm, (head)->sph_root))
!= 0
) { \
if (__comp < 0) { \
if (__comp < 0) { \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
__tmp = SPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
if (__tmp == NULL) \
...
@@ -286,7 +292,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \
...
@@ -286,7 +292,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \
(x) != NULL; \
(x) != NULL; \
(x) = SPLAY_NEXT(name, head, x))
(x) = SPLAY_NEXT(name, head, x))
/* Macros that define a red-back tree */
/* Macros that define a red-b
l
ack tree */
#define RB_HEAD(name, type) \
#define RB_HEAD(name, type) \
struct name { \
struct name { \
struct type *rbh_root;
/* root of the tree */
\
struct type *rbh_root;
/* root of the tree */
\
...
@@ -297,7 +303,7 @@ struct name { \
...
@@ -297,7 +303,7 @@ struct name { \
#define RB_INIT(root) do { \
#define RB_INIT(root) do { \
(root)->rbh_root = NULL; \
(root)->rbh_root = NULL; \
} while (0)
} while (
/*CONSTCOND*/
0)
#define RB_BLACK 0
#define RB_BLACK 0
#define RB_RED 1
#define RB_RED 1
...
@@ -320,24 +326,24 @@ struct { \
...
@@ -320,24 +326,24 @@ struct { \
RB_PARENT(elm, field) = parent; \
RB_PARENT(elm, field) = parent; \
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
RB_COLOR(elm, field) = RB_RED; \
RB_COLOR(elm, field) = RB_RED; \
} while (0)
} while (
/*CONSTCOND*/
0)
#define RB_SET_BLACKRED(black, red, field) do { \
#define RB_SET_BLACKRED(black, red, field) do { \
RB_COLOR(black, field) = RB_BLACK; \
RB_COLOR(black, field) = RB_BLACK; \
RB_COLOR(red, field) = RB_RED; \
RB_COLOR(red, field) = RB_RED; \
} while (0)
} while (
/*CONSTCOND*/
0)
#ifndef RB_AUGMENT
#ifndef RB_AUGMENT
#define RB_AUGMENT(x)
#define RB_AUGMENT(x)
do {} while (0)
#endif
#endif
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
(tmp) = RB_RIGHT(elm, field); \
(tmp) = RB_RIGHT(elm, field); \
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))
) {
\
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))
!= NULL) {
\
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
} \
} \
RB_AUGMENT(elm); \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))
) {
\
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))
!= NULL) {
\
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
else \
else \
...
@@ -349,15 +355,15 @@ struct { \
...
@@ -349,15 +355,15 @@ struct { \
RB_AUGMENT(tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (0)
} while (
/*CONSTCOND*/
0)
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
(tmp) = RB_LEFT(elm, field); \
(tmp) = RB_LEFT(elm, field); \
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))
) {
\
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))
!= NULL) {
\
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
} \
} \
RB_AUGMENT(elm); \
RB_AUGMENT(elm); \
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))
) {
\
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))
!= NULL) {
\
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
else \
else \
...
@@ -369,28 +375,66 @@ struct { \
...
@@ -369,28 +375,66 @@ struct { \
RB_AUGMENT(tmp); \
RB_AUGMENT(tmp); \
if ((RB_PARENT(tmp, field))) \
if ((RB_PARENT(tmp, field))) \
RB_AUGMENT(RB_PARENT(tmp, field)); \
RB_AUGMENT(RB_PARENT(tmp, field)); \
} while (0)
} while (
/*CONSTCOND*/
0)
/* Generates prototypes and inline functions */
/* Generates prototypes and inline functions */
#define RB_PROTOTYPE(name, type, field, cmp) \
#define RB_PROTOTYPE(name, type, field, cmp) \
void name##_RB_INSERT_COLOR(struct name *, struct type *); \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
struct type *name##_RB_REMOVE(struct name *, struct type *); \
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
struct type *name##_RB_INSERT(struct name *, struct type *); \
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
struct type *name##_RB_FIND(struct name *, struct type *); \
RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \
struct type *name##_RB_NEXT(struct type *); \
RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \
struct type *name##_RB_MINMAX(struct name *, int); \
RB_PROTOTYPE_INSERT(name, type, attr); \
\
RB_PROTOTYPE_REMOVE(name, type, attr); \
RB_PROTOTYPE_FIND(name, type, attr); \
RB_PROTOTYPE_NFIND(name, type, attr); \
RB_PROTOTYPE_NEXT(name, type, attr); \
RB_PROTOTYPE_PREV(name, type, attr); \
RB_PROTOTYPE_MINMAX(name, type, attr);
#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \
attr void name##_RB_INSERT_COLOR(struct name *, struct type *)
#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *)
#define RB_PROTOTYPE_REMOVE(name, type, attr) \
attr struct type *name##_RB_REMOVE(struct name *, struct type *)
#define RB_PROTOTYPE_INSERT(name, type, attr) \
attr struct type *name##_RB_INSERT(struct name *, struct type *)
#define RB_PROTOTYPE_FIND(name, type, attr) \
attr struct type *name##_RB_FIND(struct name *, struct type *)
#define RB_PROTOTYPE_NFIND(name, type, attr) \
attr struct type *name##_RB_NFIND(struct name *, struct type *)
#define RB_PROTOTYPE_NEXT(name, type, attr) \
attr struct type *name##_RB_NEXT(struct type *)
#define RB_PROTOTYPE_PREV(name, type, attr) \
attr struct type *name##_RB_PREV(struct type *)
#define RB_PROTOTYPE_MINMAX(name, type, attr) \
attr struct type *name##_RB_MINMAX(struct name *, int)
/* Main rb operation.
/* Main rb operation.
* Moves node close to the key of elm to top
* Moves node close to the key of elm to top
*/
*/
#define RB_GENERATE(name, type, field, cmp) \
#define RB_GENERATE(name, type, field, cmp) \
void \
RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define RB_GENERATE_STATIC(name, type, field, cmp) \
RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
RB_GENERATE_INSERT(name, type, field, cmp, attr) \
RB_GENERATE_REMOVE(name, type, field, attr) \
RB_GENERATE_FIND(name, type, field, cmp, attr) \
RB_GENERATE_NFIND(name, type, field, cmp, attr) \
RB_GENERATE_NEXT(name, type, field, attr) \
RB_GENERATE_PREV(name, type, field, attr) \
RB_GENERATE_MINMAX(name, type, field, attr)
#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
{ \
struct type *parent, *gparent, *tmp; \
struct type *parent, *gparent, *tmp; \
while ((parent = RB_PARENT(elm, field))
&&
\
while ((parent = RB_PARENT(elm, field))
!= NULL &&
\
RB_COLOR(parent, field) == RB_RED) { \
RB_COLOR(parent, field) == RB_RED) { \
gparent = RB_PARENT(parent, field); \
gparent = RB_PARENT(parent, field); \
if (parent == RB_LEFT(gparent, field)) { \
if (parent == RB_LEFT(gparent, field)) { \
...
@@ -428,9 +472,10 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
...
@@ -428,9 +472,10 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
} \
} \
} \
} \
RB_COLOR(head->rbh_root, field) = RB_BLACK; \
RB_COLOR(head->rbh_root, field) = RB_BLACK; \
} \
}
\
void \
#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
attr void \
name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
{ \
{ \
struct type *tmp; \
struct type *tmp; \
...
@@ -454,7 +499,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
...
@@ -454,7 +499,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
if (RB_RIGHT(tmp, field) == NULL || \
if (RB_RIGHT(tmp, field) == NULL || \
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
struct type *oleft; \
struct type *oleft; \
if ((oleft = RB_LEFT(tmp, field)))\
if ((oleft = RB_LEFT(tmp, field)) \
!= NULL) \
RB_COLOR(oleft, field) = RB_BLACK;\
RB_COLOR(oleft, field) = RB_BLACK;\
RB_COLOR(tmp, field) = RB_RED; \
RB_COLOR(tmp, field) = RB_RED; \
RB_ROTATE_RIGHT(head, tmp, oleft, field);\
RB_ROTATE_RIGHT(head, tmp, oleft, field);\
...
@@ -486,7 +532,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
...
@@ -486,7 +532,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
if (RB_LEFT(tmp, field) == NULL || \
if (RB_LEFT(tmp, field) == NULL || \
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
struct type *oright; \
struct type *oright; \
if ((oright = RB_RIGHT(tmp, field)))\
if ((oright = RB_RIGHT(tmp, field)) \
!= NULL) \
RB_COLOR(oright, field) = RB_BLACK;\
RB_COLOR(oright, field) = RB_BLACK;\
RB_COLOR(tmp, field) = RB_RED; \
RB_COLOR(tmp, field) = RB_RED; \
RB_ROTATE_LEFT(head, tmp, oright, field);\
RB_ROTATE_LEFT(head, tmp, oright, field);\
...
@@ -504,9 +551,10 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
...
@@ -504,9 +551,10 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm)
} \
} \
if (elm) \
if (elm) \
RB_COLOR(elm, field) = RB_BLACK; \
RB_COLOR(elm, field) = RB_BLACK; \
} \
}
\
struct type * \
#define RB_GENERATE_REMOVE(name, type, field, attr) \
attr struct type * \
name##_RB_REMOVE(struct name *head, struct type *elm) \
name##_RB_REMOVE(struct name *head, struct type *elm) \
{ \
{ \
struct type *child, *parent, *old = elm; \
struct type *child, *parent, *old = elm; \
...
@@ -518,7 +566,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \
...
@@ -518,7 +566,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \
else { \
else { \
struct type *left; \
struct type *left; \
elm = RB_RIGHT(elm, field); \
elm = RB_RIGHT(elm, field); \
while ((left = RB_LEFT(elm, field))
)
\
while ((left = RB_LEFT(elm, field))
!= NULL)
\
elm = left; \
elm = left; \
child = RB_RIGHT(elm, field); \
child = RB_RIGHT(elm, field); \
parent = RB_PARENT(elm, field); \
parent = RB_PARENT(elm, field); \
...
@@ -551,7 +599,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \
...
@@ -551,7 +599,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \
left = parent; \
left = parent; \
do { \
do { \
RB_AUGMENT(left); \
RB_AUGMENT(left); \
} while ((left = RB_PARENT(left, field))
);
\
} while ((left = RB_PARENT(left, field))
!= NULL);
\
} \
} \
goto color; \
goto color; \
} \
} \
...
@@ -572,9 +620,10 @@ color: \
...
@@ -572,9 +620,10 @@ color: \
name##_RB_REMOVE_COLOR(head, parent, child); \
name##_RB_REMOVE_COLOR(head, parent, child); \
return (old); \
return (old); \
} \
} \
\
#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \
/* Inserts a node into the RB tree */
\
/* Inserts a node into the RB tree */
\
struct type *
\
attr struct type *
\
name##_RB_INSERT(struct name *head, struct type *elm) \
name##_RB_INSERT(struct name *head, struct type *elm) \
{ \
{ \
struct type *tmp; \
struct type *tmp; \
...
@@ -599,15 +648,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) \
...
@@ -599,15 +648,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) \
RB_RIGHT(parent, field) = elm; \
RB_RIGHT(parent, field) = elm; \
RB_AUGMENT(parent); \
RB_AUGMENT(parent); \
} else \
} else \
{ \
RB_ROOT(head) = elm; \
RB_ROOT(head) = elm; \
} \
name##_RB_INSERT_COLOR(head, elm); \
name##_RB_INSERT_COLOR(head, elm); \
return (NULL); \
return (NULL); \
} \
}
\
#define RB_GENERATE_FIND(name, type, field, cmp, attr) \
/* Finds the node with the same key as elm */
\
/* Finds the node with the same key as elm */
\
struct type *
\
attr struct type *
\
name##_RB_FIND(struct name *head, struct type *elm) \
name##_RB_FIND(struct name *head, struct type *elm) \
{ \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *tmp = RB_ROOT(head); \
...
@@ -622,9 +670,33 @@ name##_RB_FIND(struct name *head, struct type *elm) \
...
@@ -622,9 +670,33 @@ name##_RB_FIND(struct name *head, struct type *elm) \
return (tmp); \
return (tmp); \
} \
} \
return (NULL); \
return (NULL); \
} \
}
\
struct type * \
#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \
/* Finds the first node greater than or equal to the search key */
\
attr struct type * \
name##_RB_NFIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *res = NULL; \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
res = tmp; \
tmp = RB_LEFT(tmp, field); \
} \
else if (comp > 0) \
tmp = RB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (res); \
}
#define RB_GENERATE_NEXT(name, type, field, attr) \
/* ARGSUSED */
\
attr struct type * \
name##_RB_NEXT(struct type *elm) \
name##_RB_NEXT(struct type *elm) \
{ \
{ \
if (RB_RIGHT(elm, field)) { \
if (RB_RIGHT(elm, field)) { \
...
@@ -643,9 +715,33 @@ name##_RB_NEXT(struct type *elm) \
...
@@ -643,9 +715,33 @@ name##_RB_NEXT(struct type *elm) \
} \
} \
} \
} \
return (elm); \
return (elm); \
} \
}
\
struct type * \
#define RB_GENERATE_PREV(name, type, field, attr) \
/* ARGSUSED */
\
attr struct type * \
name##_RB_PREV(struct type *elm) \
{ \
if (RB_LEFT(elm, field)) { \
elm = RB_LEFT(elm, field); \
while (RB_RIGHT(elm, field)) \
elm = RB_RIGHT(elm, field); \
} else { \
if (RB_PARENT(elm, field) && \
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
else { \
while (RB_PARENT(elm, field) && \
(elm == RB_LEFT(RB_PARENT(elm, field), field)))\
elm = RB_PARENT(elm, field); \
elm = RB_PARENT(elm, field); \
} \
} \
return (elm); \
}
#define RB_GENERATE_MINMAX(name, type, field, attr) \
attr struct type * \
name##_RB_MINMAX(struct name *head, int val) \
name##_RB_MINMAX(struct name *head, int val) \
{ \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *tmp = RB_ROOT(head); \
...
@@ -666,7 +762,9 @@ name##_RB_MINMAX(struct name *head, int val) \
...
@@ -666,7 +762,9 @@ name##_RB_MINMAX(struct name *head, int val) \
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
#define RB_PREV(name, x, y) name##_RB_PREV(y)
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
...
@@ -675,4 +773,29 @@ name##_RB_MINMAX(struct name *head, int val) \
...
@@ -675,4 +773,29 @@ name##_RB_MINMAX(struct name *head, int val) \
(x) != NULL; \
(x) != NULL; \
(x) = name##_RB_NEXT(x))
(x) = name##_RB_NEXT(x))
#define RB_FOREACH_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_SAFE(x, name, head, y) \
for ((x) = RB_MIN(name, head); \
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_REVERSE(x, name, head) \
for ((x) = RB_MAX(name, head); \
(x) != NULL; \
(x) = name##_RB_PREV(x))
#define RB_FOREACH_REVERSE_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
for ((x) = RB_MAX(name, head); \
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
(x) = (y))
#endif
/* _SYS_TREE_H_ */
#endif
/* _SYS_TREE_H_ */
This diff is collapsed.
Click to expand it.
common/utils/itti/timer.c
View file @
f2f0e68f
...
@@ -95,8 +95,7 @@ int timer_handle_signal(siginfo_t *info)
...
@@ -95,8 +95,7 @@ int timer_handle_signal(siginfo_t *info)
// LG: To many traces for msc timer:
// LG: To many traces for msc timer:
TMR_DEBUG
(
"Timer with id 0x%lx has expired
\n
"
,
(
long
)
timer_p
->
timer
);
TMR_DEBUG
(
"Timer with id 0x%lx has expired
\n
"
,
(
long
)
timer_p
->
timer
);
printf
(
"Timer with id 0x%lx has expired
\n
"
,
(
long
)
timer_p
->
timer
);
task_id
=
timer_p
->
task_id
;
task_id
=
timer_p
->
task_id
;
instance
=
timer_p
->
instance
;
instance
=
timer_p
->
instance
;
message_p
=
itti_alloc_new_message
(
TASK_TIMER
,
TIMER_HAS_EXPIRED
);
message_p
=
itti_alloc_new_message
(
TASK_TIMER
,
TIMER_HAS_EXPIRED
);
...
@@ -210,11 +209,6 @@ int timer_setup(
...
@@ -210,11 +209,6 @@ int timer_setup(
type
==
TIMER_PERIODIC
?
"periodic"
:
"single shot"
,
type
==
TIMER_PERIODIC
?
"periodic"
:
"single shot"
,
*
timer_id
,
interval_sec
,
interval_us
);
*
timer_id
,
interval_sec
,
interval_us
);
printf
(
"Requesting new %s timer with id 0x%lx that expires within "
"%d sec and %d usec
\n
"
,
type
==
TIMER_PERIODIC
?
"periodic"
:
"single shot"
,
*
timer_id
,
interval_sec
,
interval_us
);
timer_p
->
timer
=
timer
;
timer_p
->
timer
=
timer
;
/* Lock the queue and insert the timer at the tail */
/* Lock the queue and insert the timer at the tail */
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent.c
View file @
f2f0e68f
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "assertions.h"
#include "assertions.h"
//#define TEST_TIMER
enb_agent_instance_t
enb_agent
[
NUM_MAX_ENB_AGENT
];
enb_agent_instance_t
enb_agent
[
NUM_MAX_ENB_AGENT
];
msg_context_t
shared_ctxt
[
NUM_MAX_ENB_AGENT
];
msg_context_t
shared_ctxt
[
NUM_MAX_ENB_AGENT
];
...
@@ -327,8 +328,10 @@ int enb_agent_stop(mid_t mod_id){
...
@@ -327,8 +328,10 @@ int enb_agent_stop(mid_t mod_id){
err_code_t
enb_agent_timeout
(
void
*
args
){
err_code_t
enb_agent_timeout
(
void
*
args
){
// enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args));
//memcpy (timer_args, args, sizeof(*timer_args));
enb_agent_timer_args_t
*
timer_args
=
(
enb_agent_timer_args_t
*
)
args
;
enb_agent_timer_args_t
*
timer_args
=
(
enb_agent_timer_args_t
*
)
args
;
LOG_I
(
ENB_AGENT
,
"enb_agent %d timeout
\n
"
,
timer_args
->
mod_id
);
LOG_I
(
ENB_AGENT
,
"enb_agent %d timeout
\n
"
,
timer_args
->
mod_id
);
LOG_I
(
ENB_AGENT
,
"eNB action %d ENB flags %d
\n
"
,
timer_args
->
cc_actions
,
timer_args
->
cc_report_flags
);
LOG_I
(
ENB_AGENT
,
"eNB action %d ENB flags %d
\n
"
,
timer_args
->
cc_actions
,
timer_args
->
cc_report_flags
);
LOG_I
(
ENB_AGENT
,
"UE action %d UE flags %d
\n
"
,
timer_args
->
ue_actions
,
timer_args
->
ue_report_flags
);
LOG_I
(
ENB_AGENT
,
"UE action %d UE flags %d
\n
"
,
timer_args
->
ue_actions
,
timer_args
->
ue_report_flags
);
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent_common.c
View file @
f2f0e68f
...
@@ -312,25 +312,12 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
...
@@ -312,25 +312,12 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
//struct enb_agent_map agent_map;
//struct enb_agent_map agent_map;
enb_agent_timer_instance_t
timer_instance
;
/* The timer_id might not be the best choice for the comparison */
int
enb_agent_compare_timer
(
struct
enb_agent_timer_element_s
*
a
,
struct
enb_agent_timer_element_s
*
b
){
//if (a->timer_id) return 0;
//if (b->timer_id) return 0;
if
(
a
->
timer_id
<
b
->
timer_id
)
return
-
1
;
if
(
a
->
timer_id
>
b
->
timer_id
)
return
1
;
// equal timers
return
0
;
}
RB_GENERATE
(
enb_agent_map
,
enb_agent_timer_element_s
,
entry
,
enb_agent_compare_timer
);
err_code_t
enb_agent_init_timer
(
void
){
err_code_t
enb_agent_init_timer
(
void
){
LOG_I
(
ENB_AGENT
,
"init RB tree
\n
"
);
RB_INIT
(
&
enb_agent_head
);
RB_INIT
(
&
timer_instance
.
enb_agent_head
);
/*
/*
struct enb_agent_timer_element_s e;
struct enb_agent_timer_element_s e;
...
@@ -340,6 +327,18 @@ err_code_t enb_agent_init_timer(void){
...
@@ -340,6 +327,18 @@ err_code_t enb_agent_init_timer(void){
return
PROTOCOL__PROGRAN_ERR__NO_ERR
;
return
PROTOCOL__PROGRAN_ERR__NO_ERR
;
}
}
RB_GENERATE
(
enb_agent_map
,
enb_agent_timer_element_s
,
entry
,
enb_agent_compare_timer
);
/* The timer_id might not be the best choice for the comparison */
int
enb_agent_compare_timer
(
struct
enb_agent_timer_element_s
*
a
,
struct
enb_agent_timer_element_s
*
b
){
if
(
a
->
timer_id
<
b
->
timer_id
)
return
-
1
;
if
(
a
->
timer_id
>
b
->
timer_id
)
return
1
;
// equal timers
return
0
;
}
err_code_t
enb_agent_create_timer
(
uint32_t
interval_sec
,
err_code_t
enb_agent_create_timer
(
uint32_t
interval_sec
,
uint32_t
interval_usec
,
uint32_t
interval_usec
,
agent_id_t
agent_id
,
agent_id_t
agent_id
,
...
@@ -349,7 +348,9 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
...
@@ -349,7 +348,9 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
void
*
timer_args
,
void
*
timer_args
,
long
*
timer_id
){
long
*
timer_id
){
struct
enb_agent_timer_element_s
e
;
struct
enb_agent_timer_element_s
*
e
=
calloc
(
1
,
sizeof
(
*
e
));
DevAssert
(
e
!=
NULL
);
//uint32_t timer_id;
//uint32_t timer_id;
int
ret
=-
1
;
int
ret
=-
1
;
...
@@ -368,7 +369,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
...
@@ -368,7 +369,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
timer_args
,
timer_args
,
timer_id
);
timer_id
);
e
.
type
=
TIMER_ONE_SHOT
;
e
->
type
=
TIMER_ONE_SHOT
;
}
}
else
if
(
timer_type
==
ENB_AGENT_TIMER_TYPE_PERIODIC
){
else
if
(
timer_type
==
ENB_AGENT_TIMER_TYPE_PERIODIC
){
ret
=
timer_setup
(
interval_sec
,
ret
=
timer_setup
(
interval_sec
,
...
@@ -379,32 +380,25 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
...
@@ -379,32 +380,25 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
timer_args
,
timer_args
,
timer_id
);
timer_id
);
e
.
type
=
TIMER_PERIODIC
;
e
->
type
=
TIMER_PERIODIC
;
}
}
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
return
TIMER_SETUP_FAILED
;
return
TIMER_SETUP_FAILED
;
}
}
e
.
agent_id
=
agent_id
;
e
->
agent_id
=
agent_id
;
e
.
instance
=
instance
;
e
->
instance
=
instance
;
e
.
state
=
ENB_AGENT_TIMER_STATE_ACTIVE
;
e
->
state
=
ENB_AGENT_TIMER_STATE_ACTIVE
;
e
.
timer_id
=
*
timer_id
;
e
->
timer_id
=
*
timer_id
;
e
.
timer_args
=
timer_args
;
// e->timer_args = timer_args;
e
.
cb
=
cb
;
e
->
cb
=
cb
;
/*element should be a real pointer*/
LOG_I
(
ENB_AGENT
,
"created a timer with id 0x%lx for agent %d, instance %d
\n
"
,
RB_INSERT
(
enb_agent_map
,
&
timer_instance
.
enb_agent_head
,
e
);
e
.
timer_id
,
e
.
agent_id
,
e
.
instance
);
LOG_I
(
ENB_AGENT
,
"Created a new timer with id 0x%lx for agent %d, instance %d
\n
"
,
RB_INSERT
(
enb_agent_map
,
&
enb_agent_head
,
&
e
);
e
->
timer_id
,
e
->
agent_id
,
e
->
instance
);
/*
struct enb_agent_timer_element_s search;
search.timer_id = *timer_id;
printf("search 1: %p (expected %p)\n", RB_FIND(enb_agent_map, &enb_agent_head, &search), &e);
printf("search 1: %p (expected %p)\n", get_timer_entry(e.timer_id), &e);
*/
return
0
;
return
0
;
}
}
...
@@ -413,7 +407,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){
...
@@ -413,7 +407,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){
struct
enb_agent_timer_element_s
*
e
=
get_timer_entry
(
timer_id
);
struct
enb_agent_timer_element_s
*
e
=
get_timer_entry
(
timer_id
);
if
(
e
!=
NULL
)
{
if
(
e
!=
NULL
)
{
RB_REMOVE
(
enb_agent_map
,
&
enb_agent_head
,
&
e
);
RB_REMOVE
(
enb_agent_map
,
&
timer_instance
.
enb_agent_head
,
&
e
);
free
(
e
);
free
(
e
);
}
}
...
@@ -431,8 +425,8 @@ err_code_t enb_agent_destroy_timers(void){
...
@@ -431,8 +425,8 @@ err_code_t enb_agent_destroy_timers(void){
struct
enb_agent_timer_element_s
*
e
=
NULL
;
struct
enb_agent_timer_element_s
*
e
=
NULL
;
RB_FOREACH
(
e
,
enb_agent_map
,
&
enb_agent_head
)
{
RB_FOREACH
(
e
,
enb_agent_map
,
&
timer_instance
.
enb_agent_head
)
{
RB_REMOVE
(
enb_agent_map
,
&
enb_agent_head
,
e
);
RB_REMOVE
(
enb_agent_map
,
&
timer_instance
.
enb_agent_head
,
e
);
timer_remove
(
e
->
timer_id
);
timer_remove
(
e
->
timer_id
);
free
(
e
);
free
(
e
);
}
}
...
@@ -443,11 +437,10 @@ err_code_t enb_agent_destroy_timers(void){
...
@@ -443,11 +437,10 @@ err_code_t enb_agent_destroy_timers(void){
struct
enb_agent_timer_element_s
*
get_timer_entry
(
long
timer_id
)
{
struct
enb_agent_timer_element_s
*
get_timer_entry
(
long
timer_id
)
{
struct
enb_agent_timer_element_s
search
,
*
e
;
struct
enb_agent_timer_element_s
*
search
=
calloc
(
1
,
sizeof
(
*
search
));
memset
(
&
search
,
0
,
sizeof
(
struct
enb_agent_timer_element_s
));
search
->
timer_id
=
timer_id
;
search
.
timer_id
=
timer_id
;
return
RB_FIND
(
enb_agent_map
,
&
timer_instance
.
enb_agent_head
,
search
);
return
RB_FIND
(
enb_agent_map
,
&
enb_agent_head
,
&
search
);
}
}
/*
/*
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent_common.h
View file @
f2f0e68f
...
@@ -189,10 +189,13 @@ typedef struct enb_agent_timer_element_s{
...
@@ -189,10 +189,13 @@ typedef struct enb_agent_timer_element_s{
long
timer_id
;
/* Timer id returned by the timer API*/
long
timer_id
;
/* Timer id returned by the timer API*/
enb_agent_timer_callback_t
cb
;
enb_agent_timer_callback_t
cb
;
void
*
timer_args
;
//
void* timer_args;
}
enb_agent_timer_element_t
;
}
enb_agent_timer_element_t
;
typedef
struct
enb_agent_timer_instance_s
{
RB_HEAD
(
enb_agent_map
,
enb_agent_timer_element_s
)
enb_agent_head
;
}
enb_agent_timer_instance_t
;
err_code_t
enb_agent_init_timer
(
void
);
err_code_t
enb_agent_init_timer
(
void
);
...
@@ -214,11 +217,11 @@ err_code_t enb_agent_restart_timer(long *timer_id);
...
@@ -214,11 +217,11 @@ err_code_t enb_agent_restart_timer(long *timer_id);
struct
enb_agent_timer_element_s
*
get_timer_entry
(
long
timer_id
);
struct
enb_agent_timer_element_s
*
get_timer_entry
(
long
timer_id
);
int
enb_agent_compare_timer
(
struct
enb_agent_timer_element_s
*
a
,
struct
enb_agent_timer_element_s
*
b
);
err_code_t
enb_agent_process_timeout
(
long
timer_id
,
void
*
timer_args
);
err_code_t
enb_agent_process_timeout
(
long
timer_id
,
void
*
timer_args
);
RB_HEAD
(
enb_agent_map
,
enb_agent_timer_element_s
)
enb_agent_head
;
int
enb_agent_compare_timer
(
struct
enb_agent_timer_element_s
*
a
,
struct
enb_agent_timer_element_s
*
b
)
;
/* RB_PROTOTYPE is for .h files */
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE
(
enb_agent_map
,
enb_agent_timer_element_s
,
entry
,
enb_agent_compare_timer
);
RB_PROTOTYPE
(
enb_agent_map
,
enb_agent_timer_element_s
,
entry
,
enb_agent_compare_timer
);
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent_handler.c
View file @
f2f0e68f
...
@@ -141,15 +141,15 @@ void * enb_agent_send_message(xid_t xid,
...
@@ -141,15 +141,15 @@ void * enb_agent_send_message(xid_t xid,
err_code_t
enb_agent_process_timeout
(
long
timer_id
,
void
*
timer_args
){
err_code_t
enb_agent_process_timeout
(
long
timer_id
,
void
*
timer_args
){
struct
enb_agent_timer_element_s
*
e
=
get_timer_entry
(
timer_id
);
struct
enb_agent_timer_element_s
*
found
=
get_timer_entry
(
timer_id
);
if
(
found
==
NULL
)
goto
error
;
LOG_I
(
ENB_AGENT
,
"Found the entry (%p): timer_id is 0x%lx 0x%lx
\n
"
,
found
,
timer_id
,
found
->
timer_id
);
LOG_I
(
ENB_AGENT
,
"element %p: timer_id is 0x%lx 0x%lx
\n
"
,
e
,
timer_id
,
e
->
timer_id
);
if
(
e
==
NULL
)
goto
error
;
if
(
timer_args
==
NULL
)
if
(
timer_args
==
NULL
)
LOG_W
(
ENB_AGENT
,
"null timer args
\n
"
);
LOG_W
(
ENB_AGENT
,
"null timer args
\n
"
);
return
e
->
cb
(
timer_args
);
return
found
->
cb
(
timer_args
);
error:
error:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment