astyle applied

This commit is contained in:
Louis Adrien Dufrene
2018-11-16 08:49:28 +01:00
parent 22e44306f8
commit 700437f184
16 changed files with 9390 additions and 10737 deletions
+147 -136
View File
@@ -7,21 +7,19 @@
#include <stdlib.h>
#include <string.h>
int x_connection_fd(x_connection *_x)
{
int x_connection_fd(x_connection *_x) {
struct x_connection *x = _x;
return ConnectionNumber(x->d);
}
static GC create_gc(Display *d, char *color)
{
static GC create_gc(Display *d, char *color) {
GC ret = XCreateGC(d, DefaultRootWindow(d), 0, NULL);
XGCValues gcv;
XColor rcol, scol;
XCopyGC(d, DefaultGC(d, DefaultScreen(d)), -1L, ret);
if (XAllocNamedColor(d, DefaultColormap(d, DefaultScreen(d)),
color, &scol, &rcol)) {
color, &scol, &rcol)) {
gcv.foreground = scol.pixel;
XChangeGC(d, ret, GCForeground, &gcv);
} else ERR("X: could not allocate color '%s'\n", color);
@@ -29,82 +27,81 @@ static GC create_gc(Display *d, char *color)
return ret;
}
int x_new_color(x_connection *_x, char *color)
{
int x_new_color(x_connection *_x, char *color) {
struct x_connection *x = _x;
x->ncolors++;
x->colors = realloc(x->colors, x->ncolors * sizeof(GC));
if (x->colors == NULL) OOM;
x->colors[x->ncolors-1] = create_gc(x->d, color);
if (x->colors == NULL) OOM;
x->colors[x->ncolors-1] = create_gc(x->d, color);
x->xft_colors = realloc(x->xft_colors, x->ncolors * sizeof(XftColor));
if (x->xft_colors == NULL) OOM;
if (XftColorAllocName(x->d, DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)),
color, &x->xft_colors[x->ncolors-1]) == False)
DefaultColormap(x->d, DefaultScreen(x->d)),
color, &x->xft_colors[x->ncolors-1]) == False)
ERR("could not allocate color '%s'\n", color);
return x->ncolors - 1;
}
int x_new_font(x_connection *_x, char *font)
{
int x_new_font(x_connection *_x, char *font) {
struct x_connection *x = _x;
/* TODO: allocate fonts only once */
x->nfonts++;
x->fonts = realloc(x->fonts, x->nfonts * sizeof(XftFont *));
if (x->fonts == NULL) OOM;
x->fonts[x->nfonts-1] = XftFontOpenName(x->d, DefaultScreen(x->d), font);
if (x->fonts[x->nfonts-1] == NULL)
ERR("failed allocating font '%s'\n", font);
return x->nfonts - 1;
}
x_connection *x_open(void)
{
x_connection *x_open(void) {
struct x_connection *ret;
ret = calloc(1, sizeof(struct x_connection));
if (ret == NULL) OOM;
ret->d = XOpenDisplay(0);
LOGD("XOpenDisplay display %p return x_connection %p\n", ret->d, ret);
if (ret->d == NULL) ERR("error calling XOpenDisplay: no X? you root?\n");
x_new_color(ret, "white"); /* background color */
x_new_color(ret, "black"); /* foreground color */
x_new_font(ret, "sans-8");
return ret;
}
x_window *x_create_window(x_connection *_x, int width, int height,
char *title)
{
char *title) {
struct x_connection *x = _x;
struct x_window *ret;
ret = calloc(1, sizeof(struct x_window));
if (ret == NULL) OOM;
ret->w = XCreateSimpleWindow(x->d, DefaultRootWindow(x->d), 0, 0,
width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
WhitePixel(x->d, DefaultScreen(x->d)));
width, height, 0, WhitePixel(x->d, DefaultScreen(x->d)),
WhitePixel(x->d, DefaultScreen(x->d)));
ret->width = width;
ret->height = height;
XStoreName(x->d, ret->w, title);
ret->p = XCreatePixmap(x->d, ret->w, width, height,
DefaultDepth(x->d, DefaultScreen(x->d)));
DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, ret->p, x->colors[BACKGROUND_COLOR],
0, 0, width, height);
0, 0, width, height);
ret->xft = XftDrawCreate(x->d, ret->p,
DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)));
DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)));
if (ret->xft == NULL) ERR("XftDrawCreate failed\n");
/* enable backing store */
@@ -113,23 +110,19 @@ x_window *x_create_window(x_connection *_x, int width, int height,
att.backing_store = Always;
XChangeWindowAttributes(x->d, ret->w, CWBackingStore, &att);
}
XSelectInput(x->d, ret->w,
KeyPressMask |
ButtonPressMask |
ButtonReleaseMask |
PointerMotionMask |
ExposureMask |
StructureNotifyMask);
KeyPressMask |
ButtonPressMask |
ButtonReleaseMask |
PointerMotionMask |
ExposureMask |
StructureNotifyMask);
XMapWindow(x->d, ret->w);
return ret;
}
x_image *x_create_image(x_connection *_x, unsigned char *data,
int width, int height)
{
int width, int height) {
struct x_connection *x = _x;
struct x_image *ret;
XImage *ximage;
@@ -137,8 +130,9 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
XVisualInfo template;
int nvs;
Visual *v;
ret = calloc(1, sizeof(struct x_image));
ret = calloc(1, sizeof(struct x_image)); if (ret == NULL) OOM;
if (ret == NULL) OOM;
template.class = TrueColor;
template.depth = 32;
@@ -146,68 +140,65 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
template.green_mask = 0x00ff00;
template.blue_mask = 0x0000ff;
template.bits_per_rgb = 8;
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs);
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs);
if (vs == NULL) {
/* try again with 32 bpp */
template.depth = 32;
vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs);
VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
VisualBitsPerRGBMask, &template, &nvs);
}
if (vs == NULL) ERR("no good visual found\n");
v = vs[0].visual;
XFree(vs);
ximage = XCreateImage(x->d, v, 24, ZPixmap, 0,
(char*)data, width, height, 32, 0);
(char *)data, width, height, 32, 0);
if (ximage == NULL) ERR("image creation failed\n");
ret->p = XCreatePixmap(x->d, DefaultRootWindow(x->d), width, height, 24);
XPutImage(x->d, ret->p, DefaultGC(x->d, DefaultScreen(x->d)),
ximage, 0, 0, 0, 0, width, height);
ximage, 0, 0, 0, 0, width, height);
/* TODO: be sure it's fine to set data to NULL */
ximage->data = NULL;
XDestroyImage(ximage);
ret->width = width;
ret->height = height;
return ret;
}
static struct toplevel_window_widget *find_x_window(struct gui *g, Window id)
{
static struct toplevel_window_widget *find_x_window(struct gui *g, Window id) {
struct widget_list *cur;
struct toplevel_window_widget *w;
struct x_window *xw;
cur = g->toplevel;
while (cur) {
w = (struct toplevel_window_widget *)cur->item;
xw = w->x;
if (xw->w == id) return w;
cur = cur->next;
}
return NULL;
}
void x_events(gui *_gui)
{
void x_events(gui *_gui) {
struct gui *g = _gui;
struct widget_list *cur;
struct x_connection *x = g->x;
struct toplevel_window_widget *w;
LOGD("x_events START\n");
/* preprocessing (to "compress" events) */
cur = g->toplevel;
while (cur) {
struct x_window *xw;
w = (struct toplevel_window_widget *)cur->item;
@@ -222,58 +213,84 @@ void x_events(gui *_gui)
XEvent ev;
XNextEvent(x->d, &ev);
LOGD("XEV %d\n", ev.type);
switch (ev.type) {
case MapNotify:
case Expose:
if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
struct x_window *xw = w->x;
xw->redraw = 1;
}
break;
case ConfigureNotify:
if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
struct x_window *xw = w->x;
xw->resize = 1;
xw->new_width = ev.xconfigure.width;
xw->new_height = ev.xconfigure.height;
if (xw->new_width < 10) xw->new_width = 10;
if (xw->new_height < 10) xw->new_height = 10;
LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
}
break;
case ButtonPress:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 0);
}
break;
case ButtonRelease:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 1);
}
break;
default: if (gui_logd) WARN("TODO: X event type %d\n", ev.type); break;
case MapNotify:
case Expose:
if ((w = find_x_window(g, ev.xexpose.window)) != NULL) {
struct x_window *xw = w->x;
xw->redraw = 1;
}
break;
case ConfigureNotify:
if ((w = find_x_window(g, ev.xconfigure.window)) != NULL) {
struct x_window *xw = w->x;
xw->resize = 1;
xw->new_width = ev.xconfigure.width;
xw->new_height = ev.xconfigure.height;
if (xw->new_width < 10) xw->new_width = 10;
if (xw->new_height < 10) xw->new_height = 10;
LOGD("ConfigureNotify %d %d\n", ev.xconfigure.width, ev.xconfigure.height);
}
break;
case ButtonPress:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 0);
}
break;
case ButtonRelease:
if ((w = find_x_window(g, ev.xbutton.window)) != NULL) {
int key_modifiers = 0;
if (ev.xbutton.state & ShiftMask) key_modifiers |= KEY_SHIFT;
if (ev.xbutton.state & Mod1Mask) key_modifiers |= KEY_ALT;
if (ev.xbutton.state & ControlMask) key_modifiers |= KEY_CONTROL;
w->common.button(g, w, ev.xbutton.x, ev.xbutton.y, key_modifiers,
ev.xbutton.button, 1);
}
break;
default:
if (gui_logd) WARN("TODO: X event type %d\n", ev.type);
break;
}
}
/* postprocessing */
LOGD("post processing\n");
cur = g->toplevel;
while (cur) {
struct toplevel_window_widget *w =
(struct toplevel_window_widget *)cur->item;
(struct toplevel_window_widget *)cur->item;
struct x_window *xw = w->x;
if (xw->resize) {
LOGD("resize old %d %d new %d %d\n", xw->width, xw->height, xw->new_width, xw->new_height);
if (xw->width != xw->new_width || xw->height != xw->new_height) {
w->common.allocate(g, w, 0, 0, xw->new_width, xw->new_height);
xw->width = xw->new_width;
@@ -281,46 +298,47 @@ void x_events(gui *_gui)
XftDrawDestroy(xw->xft);
XFreePixmap(x->d, xw->p);
xw->p = XCreatePixmap(x->d, xw->w, xw->width, xw->height,
DefaultDepth(x->d, DefaultScreen(x->d)));
DefaultDepth(x->d, DefaultScreen(x->d)));
XFillRectangle(x->d, xw->p, x->colors[BACKGROUND_COLOR],
0, 0, xw->width, xw->height);
0, 0, xw->width, xw->height);
xw->xft = XftDrawCreate(x->d, xw->p,
DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)));
DefaultVisual(x->d, DefaultScreen(x->d)),
DefaultColormap(x->d, DefaultScreen(x->d)));
if (xw->xft == NULL) ERR("XftDrawCreate failed\n");
//xw->repaint = 1;
}
}
if (xw->repaint) {
w->common.paint(g, w);
xw->redraw = 1;
}
if (xw->redraw) {
struct x_connection *x = g->x;
LOGD("XCopyArea w h %d %d\n", xw->width, xw->height);
XCopyArea(x->d, xw->p, xw->w, x->colors[1],
0, 0, xw->width, xw->height, 0, 0);
0, 0, xw->width, xw->height, 0, 0);
}
cur = cur->next;
}
LOGD("x_events DONE\n");
}
void x_flush(x_connection *_x)
{
void x_flush(x_connection *_x) {
struct x_connection *x = _x;
XFlush(x->d);
}
void x_text_get_dimensions(x_connection *_c, int font, const char *t,
int *width, int *height, int *baseline)
{
int *width, int *height, int *baseline) {
struct x_connection *c = _c;
XGlyphInfo ext;
XftTextExtentsUtf8(c->d, c->fonts[font], (FcChar8 *)t, strlen(t), &ext);
*width = ext.width;
*height = c->fonts[font]->height;
*baseline = c->fonts[font]->ascent;
@@ -331,63 +349,57 @@ void x_text_get_dimensions(x_connection *_c, int font, const char *t,
/***********************************************************************/
void x_draw_line(x_connection *_c, x_window *_w, int color,
int x1, int y1, int x2, int y2)
{
int x1, int y1, int x2, int y2) {
struct x_connection *c = _c;
struct x_window *w = _w;
XDrawLine(c->d, w->p, c->colors[color], x1, y1, x2, y2);
}
void x_draw_rectangle(x_connection *_c, x_window *_w, int color,
int x, int y, int width, int height)
{
int x, int y, int width, int height) {
struct x_connection *c = _c;
struct x_window *w = _w;
XDrawRectangle(c->d, w->p, c->colors[color], x, y, width, height);
}
void x_fill_rectangle(x_connection *_c, x_window *_w, int color,
int x, int y, int width, int height)
{
int x, int y, int width, int height) {
struct x_connection *c = _c;
struct x_window *w = _w;
XFillRectangle(c->d, w->p, c->colors[color], x, y, width, height);
}
void x_draw_string(x_connection *_c, x_window *_w, int font, int color,
int x, int y, const char *t)
{
int x, int y, const char *t) {
struct x_connection *c = _c;
struct x_window *w = _w;
int tlen = strlen(t);
XftDrawStringUtf8(w->xft, &c->xft_colors[color], c->fonts[font],
x, y, (const unsigned char *)t, tlen);
x, y, (const unsigned char *)t, tlen);
}
void x_draw_clipped_string(x_connection *_c, x_window *_w, int font,
int color, int x, int y, const char *t,
int clipx, int clipy, int clipwidth, int clipheight)
{
int color, int x, int y, const char *t,
int clipx, int clipy, int clipwidth, int clipheight) {
struct x_window *w = _w;
XRectangle clip = { clipx, clipy, clipwidth, clipheight };
if (XftDrawSetClipRectangles(w->xft, 0, 0, &clip, 1) == False) abort();
x_draw_string(_c, _w, font, color, x, y, t);
if (XftDrawSetClip(w->xft, NULL) == False) abort();
}
void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y)
{
void x_draw_image(x_connection *_c, x_window *_w, x_image *_img, int x, int y) {
struct x_connection *c = _c;
struct x_window *w = _w;
struct x_image *img = _img;
XCopyArea(c->d, img->p, w->p, DefaultGC(c->d, DefaultScreen(c->d)),
0, 0, img->width, img->height, x, y);
0, 0, img->width, img->height, x, y);
}
void x_draw(x_connection *_c, x_window *_w)
{
void x_draw(x_connection *_c, x_window *_w) {
struct x_connection *c = _c;
struct x_window *w = _w;
LOGD("x_draw XCopyArea w h %d %d display %p window %d pixmap %d\n", w->width, w->height, c->d, (int)w->w, (int)w->p);
@@ -397,13 +409,13 @@ void x_draw(x_connection *_c, x_window *_w)
/* those two special functions are to plot many points
* first call x_add_point many times then x_plot_points once
*/
void x_add_point(x_connection *_c, int x, int y)
{
void x_add_point(x_connection *_c, int x, int y) {
struct x_connection *c = _c;
if (c->pts_size == c->pts_maxsize) {
c->pts_maxsize += 65536;
c->pts = realloc(c->pts, c->pts_maxsize * sizeof(XPoint));
if (c->pts == NULL) OOM;
}
@@ -412,12 +424,11 @@ void x_add_point(x_connection *_c, int x, int y)
c->pts_size++;
}
void x_plot_points(x_connection *_c, x_window *_w, int color)
{
void x_plot_points(x_connection *_c, x_window *_w, int color) {
struct x_connection *c = _c;
LOGD("x_plot_points %d points\n", c->pts_size);
struct x_window *w = _w;
XDrawPoints(c->d, w->p, c->colors[color], c->pts, c->pts_size,
CoordModeOrigin);
CoordModeOrigin);
c->pts_size = 0;
}
+54 -54
View File
@@ -31,7 +31,7 @@
# define __PLATFORM_TYPES_H__
#if !defined(NAS_NETLINK)
#include <stdint.h>
#include <stdint.h>
#endif
//-----------------------------------------------------------------------------
@@ -42,19 +42,19 @@
* let's protect potential redefinition
*/
#ifndef _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
#define _BOOLEAN_T_DEFINED_
typedef signed char boolean_t;
typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
#define BOOL_NOT(b) (b^TRUE)
#endif /* _BOOLEAN_T_DEFINED_ */
@@ -102,19 +102,19 @@ typedef enum rb_type_e {
} rb_type_t;
typedef enum {
CR_ROUND = 0,
CR_SRB12 = 1,
CR_HOL = 2,
CR_LC = 3,
CR_CQI = 4,
CR_LCP = 5,
CR_NUM = 6
CR_ROUND = 0,
CR_SRB12 = 1,
CR_HOL = 2,
CR_LC = 3,
CR_CQI = 4,
CR_LCP = 5,
CR_NUM = 6
} sorting_criterion_t;
typedef enum {
POL_FAIR = 0,
POL_GREEDY = 1,
POL_NUM = 2
POL_FAIR = 0,
POL_GREEDY = 1,
POL_NUM = 2
} accounting_policy_t;
//-----------------------------------------------------------------------------
// PHY TYPES
@@ -188,19 +188,19 @@ typedef uint32_t m_tmsi_t;
//Random UE identity length = 40 bits
#if ! defined(NOT_A_RANDOM_UE_IDENTITY)
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#endif
#if ! defined(NOT_A_RNTI)
#define NOT_A_RNTI (rnti_t)0
#define NOT_A_RNTI (rnti_t)0
#endif
#if ! defined(M_RNTI)
#define M_RNTI (rnti_t)0xFFFD
#define M_RNTI (rnti_t)0xFFFD
#endif
#if ! defined(P_RNTI)
#define P_RNTI (rnti_t)0xFFFE
#define P_RNTI (rnti_t)0xFFFE
#endif
#if ! defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xFFFF
#define SI_RNTI (rnti_t)0xFFFF
#endif
typedef enum config_action_e {
CONFIG_ACTION_NULL = 0,
@@ -225,7 +225,7 @@ typedef uint8_t ebi_t; // eps bearer id
//-----------------------------------------------------------------------------
// may be ITTI not enabled, but type instance is useful also for OTG,
#if !defined(instance_t)
typedef uint16_t instance_t;
typedef uint16_t instance_t;
#endif
typedef struct protocol_ctxt_s {
module_id_t module_id; /*!< \brief Virtualized module identifier */
@@ -247,51 +247,51 @@ typedef struct protocol_ctxt_s {
#define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \
if(eNB_fLAG == ENB_FLAG_YES) \
iNSTANCE = ENB_MODULE_ID_TO_INSTANCE(mODULE_iD); \
else \
iNSTANCE = UE_MODULE_ID_TO_INSTANCE(mODULE_iD)
if(eNB_fLAG == ENB_FLAG_YES) \
iNSTANCE = ENB_MODULE_ID_TO_INSTANCE(mODULE_iD); \
else \
iNSTANCE = UE_MODULE_ID_TO_INSTANCE(mODULE_iD)
#define INSTANCE_TO_MODULE_ID(iNSTANCE, mODULE_iD, eNB_fLAG) \
if(eNB_fLAG == ENB_FLAG_YES) \
mODULE_iD = ENB_INSTANCE_TO_MODULE_ID(iNSTANCE); \
else \
mODULE_iD = UE_INSTANCE_TO_MODULE_ID(iNSTANCE)
if(eNB_fLAG == ENB_FLAG_YES) \
mODULE_iD = ENB_INSTANCE_TO_MODULE_ID(iNSTANCE); \
else \
mODULE_iD = UE_INSTANCE_TO_MODULE_ID(iNSTANCE)
#define PROTOCOL_CTXT_COMPUTE_MODULE_ID(CtXt_h) \
INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag )
INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag )
#define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) \
MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag )
MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag )
#define PROTOCOL_CTXT_SET_BY_MODULE_ID(Ctxt_Pp, mODULE_iD, eNB_fLAG, rNTI, fRAME, sUBfRAME, eNB_iNDEX) \
(Ctxt_Pp)->module_id = mODULE_iD; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
(Ctxt_Pp)->eNB_index = eNB_iNDEX; \
PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp)
(Ctxt_Pp)->module_id = mODULE_iD; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
(Ctxt_Pp)->eNB_index = eNB_iNDEX; \
PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp)
#define PROTOCOL_CTXT_SET_BY_INSTANCE(Ctxt_Pp, iNSTANCE, eNB_fLAG, rNTI, fRAME, sUBfRAME) \
(Ctxt_Pp)->instance = iNSTANCE; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp)
(Ctxt_Pp)->instance = iNSTANCE; \
(Ctxt_Pp)->enb_flag = eNB_fLAG; \
(Ctxt_Pp)->rnti = rNTI; \
(Ctxt_Pp)->frame = fRAME; \
(Ctxt_Pp)->subframe = sUBfRAME; \
PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp)
#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02u][RNTI %" PRIx16 "]"
#define PROTOCOL_CTXT_ARGS(CTXT_Pp) \
(CTXT_Pp)->frame, \
((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \
(CTXT_Pp)->module_id, \
(CTXT_Pp)->rnti
(CTXT_Pp)->frame, \
((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \
(CTXT_Pp)->module_id, \
(CTXT_Pp)->rnti
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
void exit_function(const char* file, const char* function, const int line, const char* s);
void exit_function(const char *file, const char *function, const int line, const char *s);
#endif
+21 -39
View File
@@ -36,13 +36,13 @@
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#if defined(ENABLE_USE_MME)
#include "s1ap_eNB.h"
#include "sctp_eNB_task.h"
#else
#define EPC_MODE_ENABLED 0
#endif
#include "intertask_interface.h"
#if defined(ENABLE_USE_MME)
#include "s1ap_eNB.h"
#include "sctp_eNB_task.h"
#else
#define EPC_MODE_ENABLED 0
#endif
#endif
#include "sctp_default_values.h"
#include "LTE_SystemInformationBlockType2.h"
@@ -2043,12 +2043,12 @@ int RCconfig_gtpu(void ) {
//-----------------------------------------------------------------------------
/*
* Configure the s1ap_register_enb_req in itti message for future
* Configure the s1ap_register_enb_req in itti message for future
* communications between eNB(s) and MME.
*/
int RCconfig_S1(
MessageDef *msg_p,
uint32_t i)
MessageDef *msg_p,
uint32_t i)
//-----------------------------------------------------------------------------
{
int enb_id = 0;
@@ -2210,17 +2210,17 @@ int RCconfig_S1(
if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[j], *(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)) == 0) {
paramdef_t PLMNParams[] = PLMNPARAMS_DESC;
paramlist_def_t PLMNParamList = {ENB_CONFIG_STRING_PLMN_LIST, NULL, 0};
paramdef_t CCsParams[] = CCPARAMS_DESC;
/* map parameter checking array instances to parameter definition array instances */
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
}
/* map parameter checking array instances to parameter definition array instances */
checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;
for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) {
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
}
@@ -2229,10 +2229,8 @@ int RCconfig_S1(
paramlist_def_t S1ParamList = {ENB_CONFIG_STRING_MME_IP_ADDRESS, NULL, 0};
paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
paramdef_t NETParams[] = NETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k);
S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = enb_id;
if (strcmp(*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) {
@@ -2242,14 +2240,13 @@ int RCconfig_S1(
} else {
AssertFatal(0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n",
RC.config_file_name,
i,
RC.config_file_name,
i,
*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr));
}
S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr));
S1AP_REGISTER_ENB_REQ(msg_p).tac = *ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].uptr;
AssertFatal(!ENBParamList.paramarray[k][ENB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
&& !ENBParamList.paramarray[k][ENB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
"It seems that you use an old configuration file. Please change the existing\n"
@@ -2259,10 +2256,9 @@ int RCconfig_S1(
"to\n"
" tracking_area_code = 1; // no string!!\n"
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6){
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) {
AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
PLMNParamList.numelt);
}
@@ -2273,7 +2269,6 @@ int RCconfig_S1(
S1AP_REGISTER_ENB_REQ(msg_p).mcc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_COUNTRY_CODE_IDX].uptr;
S1AP_REGISTER_ENB_REQ(msg_p).mnc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_NETWORK_CODE_IDX].uptr;
S1AP_REGISTER_ENB_REQ(msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][ENB_MNC_DIGIT_LENGTH].u8ptr;
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).mnc_digit_length[l] == 3
|| S1AP_REGISTER_ENB_REQ(msg_p).mnc[l] < 100,
"MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
@@ -2289,12 +2284,13 @@ int RCconfig_S1(
*/
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0);
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
switch (pcch_defaultPagingCycle) {
case 32: {
S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0;
break;
}
case 64: {
S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 1;
break;
@@ -2312,32 +2308,26 @@ int RCconfig_S1(
default: {
LOG_E(S1AP, "Default I-DRX value in conf file is invalid (%i). Should be 32, 64, 128 or 256. \
Default DRX set to 32 in MME configuration\n",
pcch_defaultPagingCycle);
Default DRX set to 32 in MME configuration\n",
pcch_defaultPagingCycle);
S1AP_REGISTER_ENB_REQ(msg_p).default_drx = 0;
}
}
/* MME connection params */
sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k);
config_getlist(&S1ParamList, S1Params, sizeof(S1Params)/sizeof(paramdef_t), aprefix);
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0;
for (int l = 0; l < S1ParamList.numelt; l++) {
S1AP_REGISTER_ENB_REQ (msg_p).nb_mme += 1;
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4_address,*(S1ParamList.paramarray[l][ENB_MME_IPV4_ADDRESS_IDX].strptr));
strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6_address,*(S1ParamList.paramarray[l][ENB_MME_IPV6_ADDRESS_IDX].strptr));
if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1;
@@ -2358,7 +2348,6 @@ int RCconfig_S1(
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]; ++el) {
/* UINTARRAY gets mapped to int, see config_libconfig.c:223 */
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = S1ParamList.paramarray[l][ENB_MME_BROADCAST_PLMN_INDEX].iptr[el];
AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0
&& S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn,
"index for MME's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n",
@@ -2370,7 +2359,7 @@ int RCconfig_S1(
if (S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] == 0) {
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1AP_REGISTER_ENB_REQ(msg_p).num_plmn;
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el){
for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el) {
S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = el;
}
}
@@ -2382,18 +2371,14 @@ int RCconfig_S1(
if (EPC_MODE_ENABLED) {
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG);
config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr);
S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr);
}
sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
// NETWORK_INTERFACES
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
cidr = *(NETParams[ENB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr);
address = strtok(cidr, "/");
S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0;
@@ -2583,10 +2568,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
|| X2AP_REGISTER_ENB_REQ(msg_p).mnc < 100,
"MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
X2AP_REGISTER_ENB_REQ(msg_p).mnc);
/* CC params */
config_getlist(&CCsParamList, NULL, 0, aprefix);
X2AP_REGISTER_ENB_REQ (msg_p).num_cc = CCsParamList.numelt;
if (CCsParamList.numelt > 0) {
@@ -2633,7 +2616,6 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
AssertFatal(X2ParamList.numelt <= X2AP_MAX_NB_ENB_IP_ADDRESS,
"value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n",
X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS);
X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 = 0;
for (l = 0; l < X2ParamList.numelt; l++) {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+172 -180
View File
@@ -38,7 +38,7 @@
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#include "intertask_interface.h"
#endif
#include "flexran_agent_extern.h"
@@ -54,7 +54,7 @@ mac_rrc_data_req(
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t* const buffer_pP,
uint8_t *const buffer_pP,
const uint8_t mbsfn_sync_area
)
//--------------------------------------------------------------------------
@@ -64,7 +64,6 @@ mac_rrc_data_req(
uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
}
@@ -72,156 +71,151 @@ mac_rrc_data_req(
eNB_RRC_INST *rrc;
rrc_eNB_carrier_data_t *carrier;
LTE_BCCH_BCH_Message_t *mib;
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
if((Srb_id & RAB_OFFSET) == BCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
return 0;
}
// All even frames transmit SIB in SF 5
AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
} else {
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message,
NULL,
(void*)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
if((Srb_id & RAB_OFFSET) == BCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
return 0;
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// All even frames transmit SIB in SF 5
AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1;
}
if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
}
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
return (Sdu_size);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
} else {
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message,
NULL,
(void *)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1;
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
}
return (Sdu_size);
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if((Srb_id & RAB_OFFSET) == MCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
if((Srb_id & RAB_OFFSET) == MCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
if (LOG_DEBUGFLAG(DEBUG_RRC)) {
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
for (int i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
} /* LOG_DEBUGFLAG(DEBUG_RRC) */
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
}
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
}
#endif // #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR) { // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
#endif
return(0);
}
@@ -234,7 +228,7 @@ mac_rrc_data_ind(
const sub_frame_t sub_frameP,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t* sduP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
)
@@ -243,39 +237,38 @@ mac_rrc_data_ind(
SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
(void)sdu_size;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
if((srb_idP & RAB_OFFSET) == CCCH) {
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}
}
if((srb_idP & RAB_OFFSET) == DCCH) {
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP);
if(ue_context_p) {
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,
ue_context_p,
0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
}
if((srb_idP & RAB_OFFSET) == DCCH) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP);
if(ue_context_p){
rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,
ue_context_p,
0);
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
}
}
}
return(0);
}
//------------------------------------------------------------------------------
@@ -289,7 +282,7 @@ mac_eNB_get_rrc_status(
)
//------------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP], rntiP);
if (ue_context_p != NULL) {
@@ -300,60 +293,59 @@ mac_eNB_get_rrc_status(
}
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=1;
}
else {
} else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (rrc_agent_registered[Mod_instP]) {
agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
rrc_mac_remove_ue(Mod_instP,rntiP);
}
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=19999;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=19999;
} else {
LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) {
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
File diff suppressed because it is too large Load Diff
+43 -43
View File
@@ -71,7 +71,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
@param carrier pointer to Carrier information
@param Mod_id Instance of eNB
@param Component carrier Component carrier to configure
@param configuration Pointer Configuration Request structure
@param configuration Pointer Configuration Request structure
@return size of encoded bit stream in bytes*/
uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigurationReq *configuration
@@ -91,7 +91,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigu
uint8_t do_SIB23(uint8_t Mod_id,
int CC_id
#if defined(ENABLE_ITTI)
, RrcConfigurationReq *configuration
, RrcConfigurationReq *configuration
#endif
);
@@ -115,16 +115,16 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, LTE_SL_Destina
/** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t* buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength,
const char* dedicatedInfoNAS);
uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength,
const char *dedicatedInfoNAS);
/** \brief Generate an RRCConnectionReconfigurationComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
uint8_t
do_RRCConnectionReconfigurationComplete(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* buffer,
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
const uint8_t Transaction_id
);
@@ -143,14 +143,14 @@ PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting
@returns Size of encoded bit stream in bytes*/
uint8_t
do_RRCConnectionSetup(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t* const buffer,
uint8_t *const buffer,
const uint8_t transmission_mode,
const uint8_t Transaction_id,
LTE_SRB_ToAddModList_t** SRB_configList,
struct LTE_PhysicalConfigDedicated** physicalConfigDedicated
LTE_SRB_ToAddModList_t **SRB_configList,
struct LTE_PhysicalConfigDedicated **physicalConfigDedicated
);
/**
@@ -177,31 +177,31 @@ do_RRCConnectionSetup(
uint16_t
do_RRCConnectionReconfiguration(
const protocol_ctxt_t* const ctxt_pP,
uint8_t *buffer,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
LTE_DRB_ToReleaseList_t *DRB_list2,
struct LTE_SPS_Config *sps_Config,
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
LTE_MeasObjectToAddModList_t *MeasObj_list,
LTE_ReportConfigToAddModList_t *ReportConfig_list,
LTE_QuantityConfig_t *quantityConfig,
LTE_MeasIdToAddModList_t *MeasId_list,
LTE_MAC_MainConfig_t *mac_MainConfig,
LTE_MeasGapConfig_t *measGapConfig,
LTE_MobilityControlInfo_t *mobilityInfo,
struct LTE_MeasConfig__speedStatePars *speedStatePars,
LTE_RSRP_Range_t *rsrp,
LTE_C_RNTI_t *cba_rnti,
struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList,
const protocol_ctxt_t *const ctxt_pP,
uint8_t *buffer,
uint8_t Transaction_id,
LTE_SRB_ToAddModList_t *SRB_list,
LTE_DRB_ToAddModList_t *DRB_list,
LTE_DRB_ToReleaseList_t *DRB_list2,
struct LTE_SPS_Config *sps_Config,
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
LTE_MeasObjectToAddModList_t *MeasObj_list,
LTE_ReportConfigToAddModList_t *ReportConfig_list,
LTE_QuantityConfig_t *quantityConfig,
LTE_MeasIdToAddModList_t *MeasId_list,
LTE_MAC_MainConfig_t *mac_MainConfig,
LTE_MeasGapConfig_t *measGapConfig,
LTE_MobilityControlInfo_t *mobilityInfo,
struct LTE_MeasConfig__speedStatePars *speedStatePars,
LTE_RSRP_Range_t *rsrp,
LTE_C_RNTI_t *cba_rnti,
struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList,
LTE_SL_CommConfig_r12_t *sl_CommConfig,
LTE_SL_DiscConfig_r12_t *sl_DiscConfig
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
, LTE_SCellToAddMod_r10_t *SCell_config
, LTE_SCellToAddMod_r10_t *SCell_config
#endif
);
);
/**
\brief Generate an RRCConnectionReestablishment DL-CCCH-Message (eNB). This routine configures SRB_ToAddMod (SRB1/SRB2) and
PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS.
@@ -216,10 +216,10 @@ PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting
@returns Size of encoded bit stream in bytes*/
uint8_t
do_RRCConnectionReestablishment(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t* const buffer,
uint8_t *const buffer,
const uint8_t transmission_mode,
const uint8_t Transaction_id,
LTE_SRB_ToAddModList_t **SRB_configList,
@@ -232,8 +232,8 @@ do_RRCConnectionReestablishment(
@returns Size of encoded bit stream in bytes*/
uint8_t
do_RRCConnectionReestablishmentReject(
uint8_t Mod_id,
uint8_t* const buffer);
uint8_t Mod_id,
uint8_t *const buffer);
/**
\brief Generate an RRCConnectionReject DL-CCCH-Message (eNB).
@@ -242,8 +242,8 @@ do_RRCConnectionReestablishmentReject(
@returns Size of encoded bit stream in bytes*/
uint8_t
do_RRCConnectionReject(
uint8_t Mod_id,
uint8_t* const buffer);
uint8_t Mod_id,
uint8_t *const buffer);
/**
\brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This
@@ -286,14 +286,14 @@ OAI_UECapability_t *fill_ue_capability(char *LTE_UE_EUTRA_Capability_xer);
uint8_t
do_UECapabilityEnquiry(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* const buffer,
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
const uint8_t Transaction_id
);
uint8_t do_SecurityModeCommand(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* const buffer,
const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
const uint8_t Transaction_id,
const uint8_t cipheringAlgorithm,
const uint8_t integrityProtAlgorithm);
+128 -128
View File
@@ -64,10 +64,10 @@
#define IPV4_ADDR "%u.%u.%u.%u"
#define IPV4_ADDR_FORMAT(aDDRESS) \
(uint8_t)((aDDRESS) & 0x000000ff), \
(uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \
(uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \
(uint8_t)(((aDDRESS) & 0xff000000) >> 24)
(uint8_t)((aDDRESS) & 0x000000ff), \
(uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \
(uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \
(uint8_t)(((aDDRESS) & 0xff000000) >> 24)
//-----------------------------------------------------
@@ -84,74 +84,74 @@
#define GROUP_COMMUNICATION_RELEASE_RSP 8
#define PC5S_ESTABLISH_REQ 9
#define PC5S_ESTABLISH_RSP 10
#define PC5_DISCOVERY_MESSAGE 11
#define PC5_DISCOVERY_MESSAGE 11
#define PC5_DISCOVERY_PAYLOAD_SIZE 29
#define PC5_DISCOVERY_PAYLOAD_SIZE 29
typedef enum {
UE_STATE_OFF_NETWORK,
UE_STATE_ON_NETWORK
UE_STATE_OFF_NETWORK,
UE_STATE_ON_NETWORK
} SL_UE_STATE_t;
typedef enum {
GROUP_COMMUNICATION_RELEASE_OK = 0,
GROUP_COMMUNICATION_RELEASE_FAILURE
GROUP_COMMUNICATION_RELEASE_OK = 0,
GROUP_COMMUNICATION_RELEASE_FAILURE
} Group_Communication_Status_t;
struct GroupCommunicationEstablishReq {
uint32_t sourceL2Id;
uint32_t groupL2Id;
uint32_t groupIpAddress;
uint8_t pppp;
uint32_t sourceL2Id;
uint32_t groupL2Id;
uint32_t groupIpAddress;
uint8_t pppp;
};
struct GroupCommunicationReleaseReq {
uint32_t sourceL2Id;
uint32_t groupL2Id;
int slrb_id;
uint32_t sourceL2Id;
uint32_t groupL2Id;
int slrb_id;
};
struct DirectCommunicationEstablishReq {
uint32_t sourceL2Id;
uint32_t destinationL2Id;
uint32_t pppp;
uint32_t sourceL2Id;
uint32_t destinationL2Id;
uint32_t pppp;
};
struct PC5SEstablishReq{
uint8_t type;
uint32_t sourceL2Id;
uint32_t destinationL2Id;
struct PC5SEstablishReq {
uint8_t type;
uint32_t sourceL2Id;
uint32_t destinationL2Id;
};
struct PC5SEstablishRsp{
uint32_t slrbid_lcid28;
uint32_t slrbid_lcid29;
uint32_t slrbid_lcid30;
struct PC5SEstablishRsp {
uint32_t slrbid_lcid28;
uint32_t slrbid_lcid29;
uint32_t slrbid_lcid30;
};
//PC5_DISCOVERY MESSAGE
typedef struct {
unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE];
uint32_t measuredPower;
unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE];
uint32_t measuredPower;
} __attribute__((__packed__)) PC5DiscoveryMessage ;
struct sidelink_ctrl_element {
unsigned short type;
union {
struct GroupCommunicationEstablishReq group_comm_establish_req;
struct DirectCommunicationEstablishReq direct_comm_establish_req;
Group_Communication_Status_t group_comm_release_rsp;
//struct DirectCommunicationReleaseReq direct_comm_release_req;
SL_UE_STATE_t ue_state;
int slrb_id;
struct PC5SEstablishReq pc5s_establish_req;
struct PC5SEstablishRsp pc5s_establish_rsp;
PC5DiscoveryMessage pc5_discovery_message;
} sidelinkPrimitive;
unsigned short type;
union {
struct GroupCommunicationEstablishReq group_comm_establish_req;
struct DirectCommunicationEstablishReq direct_comm_establish_req;
Group_Communication_Status_t group_comm_release_rsp;
//struct DirectCommunicationReleaseReq direct_comm_release_req;
SL_UE_STATE_t ue_state;
int slrb_id;
struct PC5SEstablishReq pc5s_establish_req;
struct PC5SEstablishRsp pc5s_establish_rsp;
PC5DiscoveryMessage pc5_discovery_message;
} sidelinkPrimitive;
};
@@ -167,7 +167,7 @@ void *send_UE_status_notification(void *);
//#include "COMMON/openair_defs.h"
#ifndef USER_MODE
//#include <rtai.h>
//#include <rtai.h>
#endif
#include "LTE_SystemInformationBlockType1.h"
@@ -182,18 +182,18 @@ void *send_UE_status_notification(void *);
#include "LTE_SBCCH-SL-BCH-MessageType.h"
#include "LTE_BCCH-BCH-Message.h"
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
#include "LTE_MCCH-Message.h"
#include "LTE_MBSFNAreaConfiguration-r9.h"
#include "LTE_MCCH-Message.h"
#include "LTE_MBSFNAreaConfiguration-r9.h"
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
#include "LTE_SCellToAddMod-r10.h"
#include "LTE_SCellToAddMod-r10.h"
#endif
#include "LTE_AS-Config.h"
#include "LTE_AS-Context.h"
#include "LTE_UE-EUTRA-Capability.h"
#include "LTE_MeasResults.h"
#if (LTE_RRC_VERSION >= MAKE_VERSION(12, 0, 0))
#include "LTE_SidelinkUEInformation-r12.h"
#include "LTE_SidelinkUEInformation-r12.h"
#endif
/* for ImsiMobileIdentity_t */
@@ -203,66 +203,66 @@ void *send_UE_status_notification(void *);
* the code is in favor of Rel14, those defines do the translation
*/
#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0))
# define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm
# define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0
# define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1
# define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2
# define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1
# define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0
# define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04
# define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05
# define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06
# define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07
# define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08
# define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09
# define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1
# define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3
# define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4
# define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5
# define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6
# define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7
# define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8
# define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10
# define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20
# define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50
# define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100
# define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200
# define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5
# define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10
# define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16
# define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20
# define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32
# define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40
# define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64
# define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80
# define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128
# define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160
# define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320
# define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640
# define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280
# define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560
# define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
# define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320
# define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640
# define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280
# define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560
# define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120
# define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240
#define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm
#define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0
#define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1
#define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2
#define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1
#define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0
#define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04
#define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05
#define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06
#define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07
#define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08
#define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09
#define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1
#define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3
#define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4
#define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5
#define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6
#define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7
#define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8
#define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10
#define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20
#define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50
#define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100
#define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200
#define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5
#define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10
#define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16
#define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20
#define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32
#define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40
#define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64
#define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80
#define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128
#define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160
#define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320
#define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640
#define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280
#define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560
#define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
#define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320
#define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640
#define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280
#define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560
#define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120
#define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240
#endif
// This corrects something generated by asn1c which is different between Rel8 and Rel10
#if (LTE_RRC_VERSION <= MAKE_VERSION(10, 0, 0))
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10
#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11
#endif
@@ -279,13 +279,13 @@ void *send_UE_status_notification(void *);
*/
//#include "L3_rrc_defs.h"
#ifndef NO_RRM
#include "L3_rrc_interface.h"
#include "rrc_rrm_msg.h"
#include "rrc_rrm_interface.h"
#include "L3_rrc_interface.h"
#include "rrc_rrm_msg.h"
#include "rrc_rrm_interface.h"
#endif
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#include "intertask_interface.h"
#endif
/* TODO: be sure this include is correct.
@@ -293,11 +293,11 @@ void *send_UE_status_notification(void *);
* issue #186.
*/
#if !defined(ENABLE_ITTI)
# include "as_message.h"
#include "as_message.h"
#endif
#if defined(ENABLE_USE_MME)
# include "commonDef.h"
#include "commonDef.h"
#endif
//--------
@@ -516,29 +516,29 @@ typedef struct eNB_RRC_UE_s {
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
LTE_SCellToAddMod_r10_t sCell_config[2];
#endif
LTE_SRB_ToAddModList_t* SRB_configList;
LTE_SRB_ToAddModList_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_DRB_ToAddModList_t* DRB_configList;
LTE_DRB_ToAddModList_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_DRB_ToReleaseList_t* DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_SRB_ToAddModList_t *SRB_configList;
LTE_SRB_ToAddModList_t *SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_DRB_ToAddModList_t *DRB_configList;
LTE_DRB_ToAddModList_t *DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
LTE_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
uint8_t DRB_active[8];
struct LTE_PhysicalConfigDedicated* physicalConfigDedicated;
struct LTE_SPS_Config* sps_Config;
LTE_MeasObjectToAddMod_t* MeasObj[MAX_MEAS_OBJ];
struct LTE_ReportConfigToAddMod* ReportConfig[MAX_MEAS_CONFIG];
struct LTE_QuantityConfig* QuantityConfig;
struct LTE_MeasIdToAddMod* MeasId[MAX_MEAS_ID];
LTE_MAC_MainConfig_t* mac_MainConfig;
LTE_MeasGapConfig_t* measGapConfig;
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated;
struct LTE_SPS_Config *sps_Config;
LTE_MeasObjectToAddMod_t *MeasObj[MAX_MEAS_OBJ];
struct LTE_ReportConfigToAddMod *ReportConfig[MAX_MEAS_CONFIG];
struct LTE_QuantityConfig *QuantityConfig;
struct LTE_MeasIdToAddMod *MeasId[MAX_MEAS_ID];
LTE_MAC_MainConfig_t *mac_MainConfig;
LTE_MeasGapConfig_t *measGapConfig;
SRB_INFO SI;
SRB_INFO Srb0;
SRB_INFO_TABLE_ENTRY Srb1;
SRB_INFO_TABLE_ENTRY Srb2;
LTE_MeasConfig_t* measConfig;
HANDOVER_INFO* handover_info;
LTE_MeasResults_t* measResults;
LTE_MeasConfig_t *measConfig;
HANDOVER_INFO *handover_info;
LTE_MeasResults_t *measResults;
LTE_UE_EUTRA_Capability_t* UE_Capability;
LTE_UE_EUTRA_Capability_t *UE_Capability;
ImsiMobileIdentity_t imsi;
#if defined(ENABLE_SECURITY)
@@ -601,7 +601,7 @@ typedef struct eNB_RRC_UE_s {
uint32_t ue_reestablishment_timer_thres;
/* RRC inactivity timer: on timeout, should release RRC connection for inactivity on all E-RABs */
uint32_t ue_rrc_inactivity_timer;
uint32_t ue_rrc_inactivity_timer_thres;
uint32_t ue_rrc_inactivity_timer_thres;
uint8_t e_rab_release_command_flag;
int8_t reestablishment_xid;
} eNB_RRC_UE_t;
@@ -771,7 +771,7 @@ typedef struct UE_RRC_INST_s {
//current destination
uint32_t destinationL2Id;
//List of destinations
uint32_t destinationList[MAX_NUM_DEST];
uint32_t destinationList[MAX_NUM_DEST];
//sl_discovery..
SRB_INFO SL_Discovery[NB_CNX_UE];
#endif
+2957 -3507
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+34 -81
View File
@@ -61,7 +61,7 @@
#include "assertions.h"
#include "conversions.h"
#if defined(TEST_S1C_MME)
#include "oaisim_mme_test_s1c.h"
#include "oaisim_mme_test_s1c.h"
#endif
s1ap_eNB_config_t s1ap_config;
@@ -74,22 +74,17 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
uint32_t s1ap_generate_eNB_id(void)
{
uint32_t s1ap_generate_eNB_id(void) {
char *out;
char hostname[50];
int ret;
uint32_t eNB_id;
/* Retrieve the host name */
ret = gethostname(hostname, sizeof(hostname));
DevAssert(ret == 0);
out = crypt(hostname, "eurecom");
DevAssert(out != NULL);
eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
return eNB_id;
}
@@ -99,55 +94,42 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
uint16_t in_streams,
uint16_t out_streams,
uint8_t broadcast_plmn_num,
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE])
{
uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) {
MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
struct s1ap_eNB_mme_data_s *mme = NULL;
DevAssert(instance_p != NULL);
DevAssert(mme_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
sctp_new_association_req_p->in_streams = in_streams;
sctp_new_association_req_p->out_streams = out_streams;
memcpy(&sctp_new_association_req_p->remote_address,
mme_ip_address,
sizeof(*mme_ip_address));
memcpy(&sctp_new_association_req_p->local_address,
local_ip_addr,
sizeof(*local_ip_addr));
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
mme = NULL;
if ( mme == NULL ) {
/* Create new MME descriptor */
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
DevAssert(s1ap_mme_data_p != NULL);
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
s1ap_mme_data_p->assoc_id = -1;
s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num;
for (int i = 0; i < broadcast_plmn_num; ++i)
s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i];
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
/* Insert the new descriptor in list of known MME
* but not yet associated.
*/
@@ -158,12 +140,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
} else if (mme->state == S1AP_ENB_STATE_WAITING) {
instance_p->s1ap_mme_pending_nb ++;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
instance_p->instance,
mme->state, mme->cnx_id,
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
/*s1ap_mme_data_p->cnx_id = mme->cnx_id;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
@@ -181,13 +161,10 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
}
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB)
{
void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) {
s1ap_eNB_instance_t *new_instance;
uint8_t index;
DevAssert(s1ap_register_eNB != NULL);
/* Look if the provided instance already exists */
new_instance = s1ap_eNB_get_instance(instance);
@@ -197,38 +174,36 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
DevCheck(new_instance->num_plmn == s1ap_register_eNB->num_plmn, new_instance->num_plmn, s1ap_register_eNB->num_plmn, 0);
DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0);
for (int i = 0; i < new_instance->num_plmn; i++)
{
for (int i = 0; i < new_instance->num_plmn; i++) {
DevCheck(new_instance->mcc[i] == s1ap_register_eNB->mcc[i], new_instance->mcc[i], s1ap_register_eNB->mcc[i], 0);
DevCheck(new_instance->mnc[i] == s1ap_register_eNB->mnc[i], new_instance->mnc[i], s1ap_register_eNB->mnc[i], 0);
DevCheck(new_instance->mnc_digit_length[i] == s1ap_register_eNB->mnc_digit_length[i], new_instance->mnc_digit_length[i], s1ap_register_eNB->mnc_digit_length[i], 0);
}
DevCheck(new_instance->default_drx == s1ap_register_eNB->default_drx, new_instance->default_drx, s1ap_register_eNB->default_drx, 0);
} else {
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
DevAssert(new_instance != NULL);
RB_INIT(&new_instance->s1ap_ue_head);
RB_INIT(&new_instance->s1ap_mme_head);
/* Copy usefull parameters */
new_instance->instance = instance;
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
new_instance->eNB_id = s1ap_register_eNB->eNB_id;
new_instance->cell_type = s1ap_register_eNB->cell_type;
new_instance->tac = s1ap_register_eNB->tac;
for (int i = 0; i < s1ap_register_eNB->num_plmn; i++)
{
for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) {
new_instance->mcc[i] = s1ap_register_eNB->mcc[i];
new_instance->mnc[i] = s1ap_register_eNB->mnc[i];
new_instance->mnc_digit_length[i] = s1ap_register_eNB->mnc_digit_length[i];
}
new_instance->num_plmn = s1ap_register_eNB->num_plmn;
new_instance->default_drx = s1ap_register_eNB->default_drx;
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
s1ap_eNB_insert_new_instance(new_instance);
S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
instance,
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
@@ -250,16 +225,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
}
}
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
{
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
s1ap_eNB_instance_t *instance_p;
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
DevAssert(sctp_new_association_resp != NULL);
instance_p = s1ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
sctp_new_association_resp->ulp_cnx_id);
DevAssert(s1ap_mme_data_p != NULL);
@@ -269,9 +240,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return;
}
@@ -279,20 +248,17 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
/* Prepare new S1 Setup Request */
s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p);
}
static
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
{
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
int result;
DevAssert(sctp_data_ind != NULL);
#if defined(TEST_S1C_MME)
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#else
s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
@@ -301,23 +267,19 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
void s1ap_eNB_init(void)
{
void s1ap_eNB_init(void) {
S1AP_DEBUG("Starting S1AP layer\n");
s1ap_eNB_prepare_internal_data();
itti_mark_task_ready(TASK_S1AP);
MSC_START_USE();
}
void *s1ap_eNB_process_itti_msg(void* notUsed)
{
void *s1ap_eNB_process_itti_msg(void *notUsed) {
MessageDef *received_msg = NULL;
int result;
itti_receive_msg(TASK_S1AP, &received_msg);
itti_receive_msg(TASK_S1AP, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
S1AP_WARN(" *** Exiting S1AP thread\n");
itti_exit_task();
@@ -371,16 +333,16 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
case S1AP_E_RAB_SETUP_RESP: {
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_SETUP_RESP(received_msg));
&S1AP_E_RAB_SETUP_RESP(received_msg));
}
break;
case S1AP_E_RAB_MODIFY_RESP: {
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_MODIFY_RESP(received_msg));
&S1AP_E_RAB_MODIFY_RESP(received_msg));
}
break;
case S1AP_NAS_NON_DELIVERY_IND: {
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
@@ -396,11 +358,8 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
case S1AP_UE_CONTEXT_RELEASE_REQ: {
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
DevAssert(s1ap_eNB_instance_p != NULL); // test
@@ -413,9 +372,9 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
}
break;
case S1AP_E_RAB_RELEASE_RESPONSE: {
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
case S1AP_E_RAB_RELEASE_RESPONSE: {
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
}
break;
@@ -423,20 +382,18 @@ void *s1ap_eNB_process_itti_msg(void* notUsed)
S1AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
}
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
return NULL;
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
return NULL;
}
void *s1ap_eNB_task(void *arg)
{
void *s1ap_eNB_task(void *arg) {
s1ap_eNB_init();
while (1) {
(void) s1ap_eNB_process_itti_msg(NULL);
}
@@ -461,12 +418,9 @@ static int s1ap_eNB_generate_s1_setup_request(
uint8_t *buffer = NULL;
uint32_t len = 0;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(s1ap_mme_data_p != NULL);
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
/* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
@@ -474,7 +428,6 @@ static int s1ap_eNB_generate_s1_setup_request(
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest;
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest;
/* mandatory */
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
@@ -525,7 +478,6 @@ static int s1ap_eNB_generate_s1_setup_request(
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta);
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
@@ -546,6 +498,7 @@ static int s1ap_eNB_generate_s1_setup_request(
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0))
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation;
@@ -564,6 +517,7 @@ static int s1ap_eNB_generate_s1_setup_request(
// ie->value.choice.NB_IoT_DefaultPagingDRX = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
@@ -573,6 +527,5 @@ static int s1ap_eNB_generate_s1_setup_request(
/* Non UE-Associated signalling -> stream = 0 */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
return ret;
}
+103 -135
View File
@@ -66,13 +66,13 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
static
int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
static
int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
@@ -86,13 +86,13 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
static
int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
static
int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
/* Handlers matrix. Only eNB related procedure present here */
s1ap_message_decoded_callback messages_callback[][3] = {
@@ -148,16 +148,15 @@ s1ap_message_decoded_callback messages_callback[][3] = {
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) */
};
char *s1ap_direction2String(int s1ap_dir) {
static char *s1ap_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(s1ap_direction_String[s1ap_dir]);
static char *s1ap_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(s1ap_direction_String[s1ap_dir]);
}
void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown)
{
void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown) {
if (sctp_shutdown) {
/* A previously connected MME has been shutdown */
@@ -173,7 +172,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
/* If there are no more associated MME, inform eNB app */
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND);
S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0;
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
@@ -192,7 +190,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
/* If there are no more pending messages, inform eNB app */
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF);
S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb;
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
@@ -201,13 +198,10 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
}
int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
const uint8_t *const data, const uint32_t data_length)
{
const uint8_t *const data, const uint32_t data_length) {
S1AP_S1AP_PDU_t pdu;
int ret;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
if (s1ap_eNB_decode_pdu(&pdu, data, data_length) < 0) {
@@ -246,14 +240,11 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
static
int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
S1AP_S1SetupFailure_t *container;
S1AP_S1SetupFailureIEs_t *ie;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(pdu != NULL);
container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */
@@ -280,22 +271,18 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
mme_desc_p->state = S1AP_ENB_STATE_WAITING;
s1ap_handle_s1_setup_message(mme_desc_p, 0);
return 0;
}
static
int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
S1AP_S1SetupResponse_t *container;
S1AP_S1SetupResponseIEs_t *ie;
s1ap_eNB_mme_data_t *mme_desc_p;
int i;
DevAssert(pdu != NULL);
container = &pdu->choice.successfulOutcome.value.choice.S1SetupResponse;
/* S1 Setup Response == Non UE-related procedure -> stream 0 */
@@ -324,20 +311,16 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
S1AP_ServedGUMMEIsItem_t *gummei_item_p;
struct served_gummei_s *new_gummei_p;
int j;
gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i];
new_gummei_p = calloc(1, sizeof(struct served_gummei_s));
STAILQ_INIT(&new_gummei_p->served_plmns);
STAILQ_INIT(&new_gummei_p->served_group_ids);
STAILQ_INIT(&new_gummei_p->mme_codes);
S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count);
for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) {
S1AP_PLMNidentity_t *plmn_identity_p;
struct plmn_identity_s *new_plmn_identity_p;
plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j];
new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s));
TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc,
@@ -349,7 +332,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) {
S1AP_MME_Group_ID_t *mme_group_id_p;
struct served_group_id_s *new_group_id_p;
mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j];
new_group_id_p = calloc(1, sizeof(struct served_group_id_s));
OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id);
@@ -360,10 +342,8 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) {
S1AP_MME_Code_t *mme_code_p;
struct mme_code_s *new_mme_code_p;
mme_code_p = gummei_item_p->servedMMECs.list.array[j];
new_mme_code_p = calloc(1, sizeof(struct mme_code_s));
OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code);
STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next);
new_gummei_p->nb_mme_code++;
@@ -376,10 +356,10 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true);
mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
/* Optionaly set the mme name */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MMEname, false);
if (ie) {
mme_desc_p->mme_name = calloc(ie->value.choice.MMEname.size + 1, sizeof(char));
memcpy(mme_desc_p->mme_name, ie->value.choice.MMEname.buf,
@@ -394,7 +374,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
mme_desc_p->state = S1AP_ENB_STATE_CONNECTED;
mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb ++;
s1ap_handle_s1_setup_message(mme_desc_p, 0);
return 0;
}
@@ -402,14 +381,11 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
static
int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
S1AP_ErrorIndication_t *container;
S1AP_ErrorIndicationIEs_t *ie;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */
@@ -455,118 +431,156 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
case S1AP_CauseRadioNetwork_unspecified:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unspecified\n");
break;
case S1AP_CauseRadioNetwork_tx2relocoverall_expiry:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tx2relocoverall_expiry\n");
break;
case S1AP_CauseRadioNetwork_successful_handover:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_successful_handover\n");
break;
case S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason\n");
break;
case S1AP_CauseRadioNetwork_handover_cancelled:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_cancelled\n");
break;
case S1AP_CauseRadioNetwork_partial_handover:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_partial_handover\n");
break;
case S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n");
break;
case S1AP_CauseRadioNetwork_ho_target_not_allowed:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_target_not_allowed\n");
break;
case S1AP_CauseRadioNetwork_tS1relocoverall_expiry:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocoverall_expiry\n");
break;
case S1AP_CauseRadioNetwork_tS1relocprep_expiry:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocprep_expiry\n");
break;
case S1AP_CauseRadioNetwork_cell_not_available:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cell_not_available\n");
break;
case S1AP_CauseRadioNetwork_unknown_targetID:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_targetID\n");
break;
case S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n");
break;
case S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n");
break;
case S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n");
break;
case S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n");
break;
case S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason\n");
break;
case S1AP_CauseRadioNetwork_time_critical_handover:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_time_critical_handover\n");
break;
case S1AP_CauseRadioNetwork_resource_optimisation_handover:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_resource_optimisation_handover\n");
break;
case S1AP_CauseRadioNetwork_reduce_load_in_serving_cell:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_reduce_load_in_serving_cell\n");
break;
case S1AP_CauseRadioNetwork_user_inactivity:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_user_inactivity\n");
break;
case S1AP_CauseRadioNetwork_radio_connection_with_ue_lost:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_connection_with_ue_lost\n");
break;
case S1AP_CauseRadioNetwork_load_balancing_tau_required:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_load_balancing_tau_required\n");
break;
case S1AP_CauseRadioNetwork_cs_fallback_triggered:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cs_fallback_triggered\n");
break;
case S1AP_CauseRadioNetwork_ue_not_available_for_ps_service:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ue_not_available_for_ps_service\n");
break;
case S1AP_CauseRadioNetwork_radio_resources_not_available:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_resources_not_available\n");
break;
case S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure\n");
break;
case S1AP_CauseRadioNetwork_invalid_qos_combination:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_qos_combination\n");
break;
case S1AP_CauseRadioNetwork_interrat_redirection:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interrat_redirection\n");
break;
case S1AP_CauseRadioNetwork_interaction_with_other_procedure:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interaction_with_other_procedure\n");
break;
case S1AP_CauseRadioNetwork_unknown_E_RAB_ID:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_E_RAB_ID\n");
break;
case S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances\n");
break;
case S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n");
break;
case S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered\n");
break;
case S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered\n");
break;
case S1AP_CauseRadioNetwork_x2_handover_triggered:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_x2_handover_triggered\n");
break;
case S1AP_CauseRadioNetwork_redirection_towards_1xRTT:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_redirection_towards_1xRTT\n");
break;
case S1AP_CauseRadioNetwork_not_supported_QCI_value:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_not_supported_QCI_value\n");
break;
#if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0))
case S1AP_CauseRadioNetwork_invalid_CSG_Id:
S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_CSG_Id\n");
break;
@@ -575,6 +589,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
default:
S1AP_WARN("Received S1 Error indication cause radio network case not handled\n");
}
break;
case S1AP_Cause_PR_transport:
@@ -582,12 +597,15 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
case S1AP_CauseTransport_transport_resource_unavailable:
S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_transport_resource_unavailable\n");
break;
case S1AP_CauseTransport_unspecified:
S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_unspecified\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause transport case not handled\n");
}
break;
case S1AP_Cause_PR_nas:
@@ -595,20 +613,25 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
case S1AP_CauseNas_normal_release:
S1AP_WARN("Received S1 Error indication S1AP_CauseNas_normal_release\n");
break;
case S1AP_CauseNas_authentication_failure:
S1AP_WARN("Received S1 Error indication S1AP_CauseNas_authentication_failure\n");
break;
case S1AP_CauseNas_detach:
S1AP_WARN("Received S1 Error indication S1AP_CauseNas_detach\n");
break;
case S1AP_CauseNas_unspecified:
S1AP_WARN("Received S1 Error indication S1AP_CauseNas_unspecified\n");
break;
#if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0))
case S1AP_CauseNas_csg_subscription_expiry:
S1AP_WARN("Received S1 Error indication S1AP_CauseNas_csg_subscription_expiry\n");
break;
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) */
default:
S1AP_WARN("Received S1 Error indication cause nas case not handled\n");
}
@@ -620,27 +643,35 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
case S1AP_CauseProtocol_transfer_syntax_error:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_transfer_syntax_error\n");
break;
case S1AP_CauseProtocol_abstract_syntax_error_reject:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_reject\n");
break;
case S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify\n");
break;
case S1AP_CauseProtocol_message_not_compatible_with_receiver_state:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_message_not_compatible_with_receiver_state\n");
break;
case S1AP_CauseProtocol_semantic_error:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_semantic_error\n");
break;
case S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n");
break;
case S1AP_CauseProtocol_unspecified:
S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_unspecified\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause protocol case not handled\n");
}
break;
case S1AP_Cause_PR_misc:
@@ -648,24 +679,31 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
case S1AP_CauseMisc_control_processing_overload:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_control_processing_overload\n");
break;
case S1AP_CauseMisc_not_enough_user_plane_processing_resources:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_not_enough_user_plane_processing_resources\n");
break;
case S1AP_CauseMisc_hardware_failure:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_hardware_failure\n");
break;
case S1AP_CauseMisc_om_intervention:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_om_intervention\n");
break;
case S1AP_CauseMisc_unspecified:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unspecified\n");
break;
case S1AP_CauseMisc_unknown_PLMN:
S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unknown_PLMN\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause misc case not handled\n");
}
break;
}
}
@@ -676,8 +714,8 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
if (ie) {
// TODO continue
}
// TODO continue
// TODO continue
return 0;
}
@@ -685,8 +723,7 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
int i;
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
@@ -695,9 +732,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
S1AP_InitialContextSetupRequestIEs_t *ie;
S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id;
S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
@@ -710,14 +745,13 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
/* id-eNB-UE-S1AP-ID */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context 0x%06lx\n", assoc_id,
enb_ue_s1ap_id);
@@ -732,16 +766,11 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
}
ue_desc_p->rx_stream = stream;
ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ);
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
ue_desc_p->ue_initial_id = 0;
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id;
/* id-uEaggregateMaximumBitrate */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, true);
@@ -749,11 +778,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
&(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul));
asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL),
&(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl));
/* id-E-RABToBeSetupListCtxtSUReq */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true);
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs =
ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count;
@@ -765,10 +792,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
if (item_p->nAS_PDU != NULL) {
/* Only copy NAS pdu if present */
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size;
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer =
malloc(sizeof(uint8_t) * item_p->nAS_PDU->size);
memcpy(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer,
item_p->nAS_PDU->buf, item_p->nAS_PDU->size);
S1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n");
@@ -782,13 +807,10 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length =
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid);
/* Set the QOS informations */
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability =
@@ -804,15 +826,12 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms);
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms);
/* id-SecurityKey : Copy the security key */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_SecurityKey, true);
memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key,
ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size);
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0;
}
@@ -820,8 +839,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
static
int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
MessageDef *message_p = NULL;
@@ -829,9 +847,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id;
S1AP_UEContextReleaseCommand_t *container;
S1AP_UEContextReleaseCommand_IEs_t *ie;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
@@ -847,7 +863,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
case S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair:
enb_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID;
mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID;
MSC_LOG_RX_MESSAGE(
MSC_S1AP_ENB,
MSC_S1AP_MME,
@@ -858,12 +873,11 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
mme_ue_s1ap_id);
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received UE context release command for non "
"existing UE context 0x%06lx\n",
assoc_id,
enb_ue_s1ap_id);
return -1;
} else {
MSC_LOG_TX_MESSAGE(
@@ -875,7 +889,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND);
if (ue_desc_p->mme_ue_s1ap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode
ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id;
ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id;
}
S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
@@ -906,8 +920,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
static
int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
int i;
S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id;
S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id;
@@ -916,9 +929,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
MessageDef *message_p = NULL;
S1AP_E_RABSetupRequest_t *container;
S1AP_E_RABSetupRequestIEs_t *ie;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
@@ -931,14 +942,13 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
/* id-eNB-UE-S1AP-ID */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context 0x%06lx\n", assoc_id,
enb_ue_s1ap_id);
@@ -960,11 +970,9 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
}
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ);
S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id;
S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq, true);
S1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup =
@@ -972,24 +980,19 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
for (i = 0; i < ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; i++) {
S1AP_E_RABToBeSetupItemBearerSUReq_t *item_p;
item_p = &(((S1AP_E_RABToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListBearerSUReq.list.array[i])->value.choice.E_RABToBeSetupItemBearerSUReq);
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID;
// check for the NAS PDU
if (item_p->nAS_PDU.size > 0 ) {
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size;
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
memcpy(S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer,
item_p->nAS_PDU.buf, item_p->nAS_PDU.size);
// S1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]);
} else {
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0;
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL;
S1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n");
// return -1;
}
@@ -999,7 +1002,6 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size);
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length =
item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused;
/* S1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n",
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer,
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length,
@@ -1007,10 +1009,8 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
*/
/* GTP tunnel endpoint ID */
OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid);
/* Set the QOS informations */
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI;
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel;
S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability =
@@ -1020,32 +1020,27 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
}
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0;
}
static
int s1ap_eNB_handle_paging(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1AP_S1AP_PDU_t *pdu) {
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_instance_t *s1ap_eNB_instance = NULL;
MessageDef *message_p = NULL;
S1AP_Paging_t *container;
S1AP_PagingIEs_t *ie;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.Paging;
// received Paging Message from MME
S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id);
/* Paging procedure -> stream != 0 */
if (stream == 0) {
LOG_W(S1AP,"[SCTP %d] Received Paging procedure on stream (%d)\n",
assoc_id, stream);
assoc_id, stream);
return -1;
}
@@ -1056,6 +1051,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
}
s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance;
if (s1ap_eNB_instance == NULL) {
S1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : s1ap_eNB_instance is NULL\n",
assoc_id);
@@ -1063,7 +1059,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
}
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PAGING_IND);
/* convert S1AP_PagingIEs_t to s1ap_paging_ind_t */
/* id-UEIdentityIndexValue : convert UE Identity Index value */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container,
@@ -1071,13 +1066,12 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
S1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue);
S1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n",
assoc_id,(uint32_t)S1AP_PAGING_IND(message_p).ue_index_value);
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0;
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0;
/* id-UEPagingID */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_UEPagingID, true);
/* convert UE Paging Identity */
if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_s_TMSI) {
S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi;
@@ -1116,7 +1110,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
}
S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256;
/* id-pagingDRX */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_pagingDRX, false);
@@ -1146,7 +1139,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
memset (&S1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256);
memset (&S1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256);
S1AP_PAGING_IND(message_p).tai_size = 0;
/* id-TAIList */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_TAIList, true);
@@ -1166,7 +1158,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
S1AP_PAGING_IND(message_p).tac[i]);
}
//paging parameter values
S1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id,
S1AP_PAGING_IND(message_p).ue_index_value, S1AP_PAGING_IND(message_p).cn_domain,
@@ -1177,18 +1168,15 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1],
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3],
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]);
/* send message to RRC */
itti_send_msg_to_task(TASK_RRC_ENB, s1ap_eNB_instance->instance, message_p);
return 0;
}
static
int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
uint32_t stream,
S1AP_S1AP_PDU_t *pdu) {
int i, nb_of_e_rabs_failed;
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
@@ -1197,9 +1185,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
S1AP_E_RABModifyRequestIEs_t *ie;
S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id;
S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABModifyRequest;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
@@ -1212,14 +1198,13 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
/* id-eNB-UE-S1AP-ID */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received E-RAB modify request for non "
"existing UE context 0x%06lx\n", assoc_id,
enb_ue_s1ap_id);
@@ -1239,9 +1224,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)",
ue_desc_p->mme_ue_s1ap_id, mme_ue_s1ap_id);
message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP);
S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true);
@@ -1253,22 +1236,18 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_Cause_PR_radioNetwork;
S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id;
}
S1AP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed;
S1AP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed;
s1ap_eNB_e_rab_modify_resp(mme_desc_p->s1ap_eNB_instance->instance,
&S1AP_E_RAB_MODIFY_RESP(message_p));
message_p = NULL;
return -1;
}
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_MODIFY_REQ);
S1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id;
S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id;
S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
/* id-E-RABToBeModifiedListBearerModReq */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true);
@@ -1283,9 +1262,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
// check for the NAS PDU
if (item_p->nAS_PDU.size > 0 ) {
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size;
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size);
memcpy(S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer,
item_p->nAS_PDU.buf, item_p->nAS_PDU.size);
} else {
@@ -1296,26 +1273,22 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
/* Set the QOS informations */
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI;
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel;
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability;
S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability =
item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
}
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0;
}
// handle e-rab release command and send it to rrc_end
static
int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
uint32_t stream,
S1AP_S1AP_PDU_t *pdu) {
int i;
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
@@ -1324,9 +1297,7 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
S1AP_E_RABReleaseCommandIEs_t *ie;
S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id;
S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.E_RABReleaseCommand;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
@@ -1338,14 +1309,13 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
/* id-eNB-UE-S1AP-ID */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id,
ie->value.choice.ENB_UE_S1AP_ID);
return -1;
@@ -1367,14 +1337,13 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
S1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_S1AP_ID %ld mme_ue_s1ap_id %ld\n",
assoc_id, enb_ue_s1ap_id, mme_ue_s1ap_id);
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND);
S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id;
/* id-NAS-PDU */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NAS_PDU, false);
if(ie && ie->value.choice.NAS_PDU.size > 0) {
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size;
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer =
@@ -1400,6 +1369,5 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
}
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0;
}
+49 -85
View File
@@ -61,13 +61,10 @@ int s1ap_eNB_handle_nas_first_req(
S1AP_InitialUEMessage_IEs_t *ie;
uint8_t *buffer = NULL;
uint32_t length = 0;
DevAssert(s1ap_nas_first_req_p != NULL);
/* Retrieve the S1AP eNB instance associated with Mod_id */
instance_p = s1ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_initialUEMessage;
@@ -81,6 +78,7 @@ int s1ap_eNB_handle_nas_first_req(
instance_p,
s1ap_nas_first_req_p->establishment_cause,
s1ap_nas_first_req_p->ue_identity.gummei);
if (mme_desc_p) {
S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through GUMMEI MCC %d MNC %d MMEGI %d MMEC %d\n",
instance,
@@ -101,6 +99,7 @@ int s1ap_eNB_handle_nas_first_req(
s1ap_nas_first_req_p->establishment_cause,
s1ap_nas_first_req_p->selected_plmn_identity,
s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code);
if (mme_desc_p) {
S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through S-TMSI MMEC %d and selected PLMN Identity index %d MCC %d MNC %d\n",
instance,
@@ -121,6 +120,7 @@ int s1ap_eNB_handle_nas_first_req(
instance_p,
s1ap_nas_first_req_p->establishment_cause,
s1ap_nas_first_req_p->selected_plmn_identity);
if (mme_desc_p) {
S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n",
instance,
@@ -140,6 +140,7 @@ int s1ap_eNB_handle_nas_first_req(
mme_desc_p = s1ap_eNB_nnsf_select_mme(
instance_p,
s1ap_nas_first_req_p->establishment_cause);
if (mme_desc_p) {
S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through highest relative capacity\n",
instance,
@@ -153,7 +154,6 @@ int s1ap_eNB_handle_nas_first_req(
* In case eNB has no MME associated, the eNB should inform RRC and discard
* this request.
*/
S1AP_WARN("No MME is associated to the eNB\n");
// TODO: Inform RRC
return -1;
@@ -164,7 +164,6 @@ int s1ap_eNB_handle_nas_first_req(
*/
ue_desc_p = s1ap_eNB_allocate_new_UE_context();
DevAssert(ue_desc_p != NULL);
/* Keep a reference to the selected MME */
ue_desc_p->mme_ref = mme_desc_p;
ue_desc_p->ue_initial_id = s1ap_nas_first_req_p->ue_initial_id;
@@ -173,7 +172,6 @@ int s1ap_eNB_handle_nas_first_req(
do {
struct s1ap_eNB_ue_context_s *collision_p;
/* Peek a random value for the eNB_ue_s1ap_id */
ue_desc_p->eNB_ue_s1ap_id = (random() + random()) & 0x00ffffff;
@@ -194,7 +192,6 @@ int s1ap_eNB_handle_nas_first_req(
ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU;
@@ -210,7 +207,6 @@ int s1ap_eNB_handle_nas_first_req(
#endif
ie->value.choice.NAS_PDU.size = s1ap_nas_first_req_p->nas_pdu.length;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_TAI;
@@ -223,7 +219,6 @@ int s1ap_eNB_handle_nas_first_req(
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
&ie->value.choice.TAI.pLMNidentity);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI;
@@ -242,11 +237,9 @@ int s1ap_eNB_handle_nas_first_req(
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
&ie->value.choice.EUTRAN_CGI.pLMNidentity);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* Set the establishment cause according to those provided by RRC */
DevCheck(s1ap_nas_first_req_p->establishment_cause < RRC_CAUSE_LAST,
s1ap_nas_first_req_p->establishment_cause, RRC_CAUSE_LAST, 0);
/* mandatory */
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_RRC_Establishment_Cause;
@@ -300,6 +293,7 @@ int s1ap_eNB_handle_nas_first_req(
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0))
if (0) {
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CellAccessMode;
@@ -311,6 +305,7 @@ int s1ap_eNB_handle_nas_first_req(
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0))
if (0) {
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress;
@@ -331,6 +326,7 @@ int s1ap_eNB_handle_nas_first_req(
}
#if (S1AP_VERSION >= MAKE_VERSION(11, 0, 0))
/* optional */
if (0) {
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
@@ -372,6 +368,7 @@ int s1ap_eNB_handle_nas_first_req(
}
#if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0))
/* optional */
if (0) {
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
@@ -403,6 +400,7 @@ int s1ap_eNB_handle_nas_first_req(
}
#if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0))
/* optional */
if (0) {
ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t));
@@ -422,6 +420,7 @@ int s1ap_eNB_handle_nas_first_req(
// ie->value.choice.Coverage_Level = ue_release_req_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0)) */
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(11, 0, 0)) */
@@ -435,7 +434,6 @@ int s1ap_eNB_handle_nas_first_req(
/* Update the current S1AP UE state */
ue_desc_p->ue_state = S1AP_UE_WAITING_CSR;
/* Assign a stream for this UE :
* From 3GPP 36.412 7)Transport layers:
* Within the SCTP association established between one MME and eNB pair:
@@ -455,7 +453,6 @@ int s1ap_eNB_handle_nas_first_req(
}
ue_desc_p->tx_stream = mme_desc_p->nextstream;
MSC_LOG_TX_MESSAGE(
MSC_S1AP_ENB,
MSC_S1AP_MME,
@@ -464,11 +461,9 @@ int s1ap_eNB_handle_nas_first_req(
MSC_AS_TIME_FMT" initialUEMessage initiatingMessage eNB_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_desc_p->eNB_ue_s1ap_id);
/* Send encoded message over sctp */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id,
buffer, length, ue_desc_p->tx_stream);
return 0;
}
@@ -502,20 +497,17 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
}
s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance;
/* Prepare the S1AP message to encode */
container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, true);
mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true);
enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID;
if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) {
enb_ue_s1ap_id)) == NULL) {
MSC_LOG_RX_DISCARDED_MESSAGE(
MSC_S1AP_ENB,
MSC_S1AP_MME,
@@ -563,7 +555,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
assoc_id,
mme_ue_s1ap_id);
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NAS_PDU, true);
/* Forward the NAS PDU to RRC */
@@ -572,7 +563,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id,
ue_desc_p->eNB_ue_s1ap_id,
ie->value.choice.NAS_PDU.buf,
ie->value.choice.NAS_PDU.size);
return 0;
}
@@ -587,9 +577,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
S1AP_UplinkNASTransport_IEs_t *ie;
uint8_t *buffer;
uint32_t length;
DevAssert(s1ap_uplink_nas_p != NULL);
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(s1ap_eNB_instance_p != NULL);
@@ -619,7 +607,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UplinkNASTransport;
out = &pdu.choice.initiatingMessage.value.choice.UplinkNASTransport;
/* mandatory */
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -627,7 +614,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -635,7 +621,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU;
@@ -644,7 +629,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
ie->value.choice.NAS_PDU.buf = s1ap_uplink_nas_p->nas_pdu.buffer;
ie->value.choice.NAS_PDU.size = s1ap_uplink_nas_p->nas_pdu.length;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI;
@@ -660,7 +644,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
0,
&ie->value.choice.EUTRAN_CGI.cell_ID);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_TAI;
@@ -673,9 +656,9 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
&ie->value.choice.TAI.pLMNidentity);
TAC_TO_ASN1(s1ap_eNB_instance_p->tac, &ie->value.choice.TAI.tAC);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0))
if (0) {
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress;
@@ -687,6 +670,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0))
if (0) {
ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_SIPTO_L_GW_TransportLayerAddress;
@@ -705,6 +689,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
// ie->value.choice.LHN_ID =;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(10, 0, 0)) */
@@ -723,12 +708,10 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
}
@@ -745,9 +728,7 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
S1AP_NASNonDeliveryIndication_IEs_t *ie;
uint8_t *buffer;
uint32_t length;
DevAssert(s1ap_nas_non_delivery_ind != NULL);
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(s1ap_eNB_instance_p != NULL);
@@ -770,7 +751,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_NASNonDeliveryIndication;
out = &pdu.choice.initiatingMessage.value.choice.NASNonDeliveryIndication;
/* mandatory */
ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -778,7 +758,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -786,7 +765,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU;
@@ -794,9 +772,7 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_NAS_PDU;
ie->value.choice.NAS_PDU.buf = s1ap_nas_non_delivery_ind->nas_pdu.buffer;
ie->value.choice.NAS_PDU.size = s1ap_nas_non_delivery_ind->nas_pdu.length;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Cause;
@@ -825,7 +801,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
@@ -846,10 +821,8 @@ int s1ap_eNB_initial_ctxt_resp(
uint8_t *buffer = NULL;
uint32_t length;
int i;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(initial_ctxt_resp_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
@@ -879,7 +852,6 @@ int s1ap_eNB_initial_ctxt_resp(
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_InitialContextSetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.InitialContextSetupResponse;
/* mandatory */
ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -887,7 +859,6 @@ int s1ap_eNB_initial_ctxt_resp(
ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -895,7 +866,6 @@ int s1ap_eNB_initial_ctxt_resp(
ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = initial_ctxt_resp_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes;
@@ -912,7 +882,7 @@ int s1ap_eNB_initial_ctxt_resp(
item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID = initial_ctxt_resp_p->e_rabs[i].e_rab_id;
GTP_TEID_TO_ASN1(initial_ctxt_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemCtxtSURes.gTP_TEID);
item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf = malloc(initial_ctxt_resp_p->e_rabs[i].eNB_addr.length);
memcpy(item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf,
memcpy(item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf,
initial_ctxt_resp_p->e_rabs[i].eNB_addr.buffer,
initial_ctxt_resp_p->e_rabs[i].eNB_addr.length);
item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].eNB_addr.length;
@@ -946,23 +916,27 @@ int s1ap_eNB_initial_ctxt_resp(
item->value.choice.E_RABItem.e_RAB_ID = initial_ctxt_resp_p->e_rabs_failed[i].e_rab_id;
item->value.choice.E_RABItem.cause.present = initial_ctxt_resp_p->e_rabs_failed[i].cause;
switch(item->value.choice.E_RABItem.cause.present)
{
switch(item->value.choice.E_RABItem.cause.present) {
case S1AP_Cause_PR_radioNetwork:
item->value.choice.E_RABItem.cause.choice.radioNetwork = initial_ctxt_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_transport:
item->value.choice.E_RABItem.cause.choice.transport = initial_ctxt_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_nas:
item->value.choice.E_RABItem.cause.choice.nas = initial_ctxt_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_protocol:
item->value.choice.E_RABItem.cause.choice.protocol = initial_ctxt_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_misc:
item->value.choice.E_RABItem.cause.choice.misc = initial_ctxt_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_NOTHING:
default:
break;
@@ -1000,12 +974,10 @@ int s1ap_eNB_initial_ctxt_resp(
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
initial_ctxt_resp_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
}
@@ -1021,10 +993,8 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
S1AP_UECapabilityInfoIndicationIEs_t *ie;
uint8_t *buffer;
uint32_t length;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(ue_cap_info_ind_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
@@ -1054,7 +1024,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UECapabilityInfoIndication;
out = &pdu.choice.initiatingMessage.value.choice.UECapabilityInfoIndication;
/* mandatory */
ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -1062,7 +1031,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -1070,7 +1038,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UERadioCapability;
@@ -1079,9 +1046,9 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
ie->value.choice.UERadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer;
ie->value.choice.UERadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(12, 0, 0))
if (0) {
ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UERadioCapabilityForPaging;
@@ -1090,6 +1057,7 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
// ie->value.choice.UERadioCapabilityForPaging = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
@@ -1107,12 +1075,10 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_cap_info_ind_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
}
@@ -1129,15 +1095,13 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
uint8_t *buffer = NULL;
uint32_t length;
int i;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(e_rab_setup_resp_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) {
e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) {
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n",
e_rab_setup_resp_p->eNB_ue_s1ap_id);
@@ -1162,7 +1126,6 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABSetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.E_RABSetupResponse;
/* mandatory */
ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -1170,7 +1133,6 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -1231,23 +1193,27 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
item->value.choice.E_RABItem.e_RAB_ID = e_rab_setup_resp_p->e_rabs_failed[i].e_rab_id;
item->value.choice.E_RABItem.cause.present = e_rab_setup_resp_p->e_rabs_failed[i].cause;
switch(item->value.choice.E_RABItem.cause.present)
{
switch(item->value.choice.E_RABItem.cause.present) {
case S1AP_Cause_PR_radioNetwork:
item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_setup_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_transport:
item->value.choice.E_RABItem.cause.choice.transport = e_rab_setup_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_nas:
item->value.choice.E_RABItem.cause.choice.nas = e_rab_setup_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_protocol:
item->value.choice.E_RABItem.cause.choice.protocol = e_rab_setup_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_misc:
item->value.choice.E_RABItem.cause.choice.misc = e_rab_setup_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_NOTHING:
default:
break;
@@ -1277,6 +1243,7 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes);
*/
fprintf(stderr, "start encode\n");
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
S1AP_ERROR("Failed to encode uplink transport\n");
/* Encode procedure has failed... */
@@ -1292,12 +1259,10 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
e_rab_setup_resp_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
}
@@ -1311,19 +1276,16 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
S1AP_S1AP_PDU_t pdu;
S1AP_E_RABModifyResponse_t *out;
S1AP_E_RABModifyResponseIEs_t *ie;
uint8_t *buffer = NULL;
uint32_t length;
int i;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(e_rab_modify_resp_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) {
e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) {
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n",
e_rab_modify_resp_p->eNB_ue_s1ap_id);
@@ -1348,7 +1310,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABModifyResponse;
out = &pdu.choice.successfulOutcome.value.choice.E_RABModifyResponse;
/* mandatory */
ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -1356,7 +1317,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -1402,23 +1362,27 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
item->value.choice.E_RABItem.e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id;
item->value.choice.E_RABItem.cause.present = e_rab_modify_resp_p->e_rabs_failed[i].cause;
switch(item->value.choice.E_RABItem.cause.present)
{
switch(item->value.choice.E_RABItem.cause.present) {
case S1AP_Cause_PR_radioNetwork:
item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_transport:
item->value.choice.E_RABItem.cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_nas:
item->value.choice.E_RABItem.cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_protocol:
item->value.choice.E_RABItem.cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_misc:
item->value.choice.E_RABItem.cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_NOTHING:
default:
break;
@@ -1442,6 +1406,7 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
}
fprintf(stderr, "start encode\n");
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
S1AP_ERROR("Failed to encode uplink transport\n");
/* Encode procedure has failed... */
@@ -1457,7 +1422,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
e_rab_modify_resp_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
@@ -1477,14 +1441,13 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
uint8_t *buffer = NULL;
uint32_t length;
int i;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(e_rab_release_resp_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) {
e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) {
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %u\n",
e_rab_release_resp_p->eNB_ue_s1ap_id);
@@ -1498,7 +1461,6 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABReleaseResponse;
out = &pdu.choice.successfulOutcome.value.choice.E_RABReleaseResponse;
/* mandatory */
ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
@@ -1506,7 +1468,6 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
@@ -1552,23 +1513,27 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
item->value.choice.E_RABItem.e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id;
item->value.choice.E_RABItem.cause.present = e_rab_release_resp_p->e_rabs_failed[i].cause;
switch(item->value.choice.E_RABItem.cause.present)
{
switch(item->value.choice.E_RABItem.cause.present) {
case S1AP_Cause_PR_radioNetwork:
item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_transport:
item->value.choice.E_RABItem.cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_nas:
item->value.choice.E_RABItem.cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_protocol:
item->value.choice.E_RABItem.cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_misc:
item->value.choice.E_RABItem.cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value;
break;
case S1AP_Cause_PR_NOTHING:
default:
break;
@@ -1592,6 +1557,7 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(12, 0, 0))
if(0) {
ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation;
@@ -1600,9 +1566,10 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
// ie->value.choice.UserLocationInformation = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
fprintf(stderr, "start encode\n");
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
S1AP_ERROR("Failed to encode release response\n");
/* Encode procedure has failed... */
@@ -1618,14 +1585,11 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
e_rab_release_resp_p->eNB_ue_s1ap_id,
ue_context_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
S1AP_INFO("e_rab_release_response sended eNB_UE_S1AP_ID %d mme_ue_s1ap_id %d nb_of_e_rabs_released %d nb_of_e_rabs_failed %d\n",
e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed);
return 0;
}
+786 -922
View File
File diff suppressed because it is too large Load Diff