Changeset fbc5ca080beedf8ca032cdd409db30838843f79b

Show
Ignore:
Timestamp:
03/04/10 10:39:50 (5 months ago)
Author:
Harald Welte <laforge@gnumonks.org>
Parents:
3c9c5f941d6053985a3fb2aaea2774a24df1bfd3
Children:
afedeabd919972dcc3968b0d9743dc0b1a80774c
git-committer:
Harald Welte <laforge@gnumonks.org> / 2010-03-04T10:39:50Z+0100
Message:

move gsm_band_name() and gsm_band_parse() to libosmocore

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • openbsc/src/gsm_data.c

    rdfe6c7d rfbc5ca0  
    1 /* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org> 
     1/* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> 
    22 * 
    33 * All Rights Reserved 
     
    2828#include <openbsc/gsm_data.h> 
    2929#include <osmocore/talloc.h> 
     30#include <osmocore/gsm_utils.h> 
    3031#include <openbsc/abis_nm.h> 
    3132#include <osmocore/statistics.h> 
     
    436437} 
    437438 
    438 char *gsm_band_name(enum gsm_band band) 
    439 { 
    440         switch (band) { 
    441         case GSM_BAND_450: 
    442                 return "GSM450"; 
    443         case GSM_BAND_480: 
    444                 return "GSM450"; 
    445         case GSM_BAND_750: 
    446                 return "GSM750"; 
    447         case GSM_BAND_810: 
    448                 return "GSM810"; 
    449         case GSM_BAND_850: 
    450                 return "GSM850"; 
    451         case GSM_BAND_900: 
    452                 return "GSM900"; 
    453         case GSM_BAND_1800: 
    454                 return "DCS1800"; 
    455         case GSM_BAND_1900: 
    456                 return "PCS1900"; 
    457         } 
    458         return "invalid"; 
    459 } 
    460  
    461 enum gsm_band gsm_band_parse(const char* mhz) 
    462 { 
    463         while (*mhz && !isdigit(*mhz)) 
    464                 mhz++; 
    465  
    466         if (*mhz == '\0') 
    467                 return -EINVAL; 
    468  
    469         switch (atoi(mhz)) { 
    470         case 450: 
    471                 return GSM_BAND_450; 
    472         case 480: 
    473                 return GSM_BAND_480; 
    474         case 750: 
    475                 return GSM_BAND_750; 
    476         case 810: 
    477                 return GSM_BAND_810; 
    478         case 850: 
    479                 return GSM_BAND_850; 
    480         case 900: 
    481                 return GSM_BAND_900; 
    482         case 1800: 
    483                 return GSM_BAND_1800; 
    484         case 1900: 
    485                 return GSM_BAND_1900; 
    486         default: 
    487                 return -EINVAL; 
    488         } 
    489 } 
    490  
    491439static const char *gsm_auth_policy_names[] = { 
    492440        [GSM_AUTH_POLICY_CLOSED] = "closed",