diff options
| author | Andreas Eversberg <jolly@eversberg.eu> | 2011-09-27 12:06:55 +0200 | 
|---|---|---|
| committer | Harald Welte <laforge@gnumonks.org> | 2011-10-10 08:38:58 +0200 | 
| commit | 78122ab56817693feaee3f50307ebae72a2492d0 (patch) | |
| tree | 62adfcea705b935b382c18292ad50a6b43d80f00 /src | |
| parent | 742fc79d58c1b19bdb20e763acf401398008c1a0 (diff) | |
Added defines to use primitive/operation tuples in switch/case statements
Diffstat (limited to 'src')
| -rw-r--r-- | src/gsm/lapdm.c | 78 | 
1 files changed, 20 insertions, 58 deletions
| diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index 9e7172d6..82f8b0c1 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -405,70 +405,32 @@ static int send_rslms_dlsap(struct osmo_dlsap_prim *dp,  	struct lapdm_msg_ctx *mctx = &mdl->mctx;  	uint8_t rll_msg = 0; -	switch (dp->oph.primitive) { -	case PRIM_DL_EST: -		switch (dp->oph.operation) { -		case PRIM_OP_INDICATION: -			rll_msg = RSL_MT_EST_IND; -			break; -		case PRIM_OP_CONFIRM: -			rll_msg = RSL_MT_EST_CONF; -			break; -		default: -			; -		} +	switch (OSMO_PRIM_HDR(&dp->oph)) { +	case OSMO_PRIM(PRIM_DL_EST, PRIM_OP_INDICATION): +		rll_msg = RSL_MT_EST_IND;  		break; -	case PRIM_DL_DATA: -		switch (dp->oph.operation) { -		case PRIM_OP_INDICATION: -			rll_msg = RSL_MT_DATA_IND; -			break; -		default: -			; -		} +	case OSMO_PRIM(PRIM_DL_EST, PRIM_OP_CONFIRM): +		rll_msg = RSL_MT_EST_CONF;  		break; -	case PRIM_DL_UNIT_DATA: -		switch (dp->oph.operation) { -		case PRIM_OP_INDICATION: -			return send_rslms_rll_l3_ui(mctx, dp->oph.msg); -		default: -			; -		} +	case OSMO_PRIM(PRIM_DL_DATA, PRIM_OP_INDICATION): +		rll_msg = RSL_MT_DATA_IND;  		break; -	case PRIM_DL_REL: -		switch (dp->oph.operation) { -		case PRIM_OP_INDICATION: -			rll_msg = RSL_MT_REL_IND; -			break; -		case PRIM_OP_CONFIRM: -			rll_msg = RSL_MT_REL_CONF; -			break; -		default: -			; -		} +	case OSMO_PRIM(PRIM_DL_UNIT_DATA, PRIM_OP_INDICATION): +		return send_rslms_rll_l3_ui(mctx, dp->oph.msg); +	case OSMO_PRIM(PRIM_DL_REL, PRIM_OP_INDICATION): +		rll_msg = RSL_MT_REL_IND;  		break; -	case PRIM_DL_SUSP: -		switch (dp->oph.operation) { -		case PRIM_OP_CONFIRM: -			rll_msg = RSL_MT_SUSP_CONF; -			break; -		default: -			; -		} +	case OSMO_PRIM(PRIM_DL_REL, PRIM_OP_CONFIRM): +		rll_msg = RSL_MT_REL_CONF;  		break; -	case PRIM_MDL_ERROR: -		switch (dp->oph.operation) { -		case PRIM_OP_INDICATION: -			rsl_rll_error(dp->u.error_ind.cause, mctx); -			if (dp->oph.msg) -				msgb_free(dp->oph.msg); -			return 0; -		default: -			; -		} +	case OSMO_PRIM(PRIM_DL_SUSP, PRIM_OP_CONFIRM): +		rll_msg = RSL_MT_SUSP_CONF;  		break; -	default: -		; +	case OSMO_PRIM(PRIM_MDL_ERROR, PRIM_OP_INDICATION): +		rsl_rll_error(dp->u.error_ind.cause, mctx); +		if (dp->oph.msg) +			msgb_free(dp->oph.msg); +		return 0;  	}  	if (!rll_msg) { | 
