root/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2010, Sangoma Technologies 
   3  * David Yat Sin <davidy@sangoma.com>
   4  * All rights reserved.
   5  *
   6  * Redistribution and use in source and binary forms, with or without
   7  * modification, are permitted provided that the following conditions
   8  * are met:
   9  *
  10  * * Redistributions of source code must retain the above copyright
  11  * notice, this list of conditions and the following disclaimer.
  12  *
  13  * * Redistributions in binary form must reproduce the above copyright
  14  * notice, this list of conditions and the following disclaimer in the
  15  * documentation and/or other materials provided with the distribution.
  16  *
  17  * * Neither the name of the original author; nor the names of any contributors
  18  * may be used to endorse or promote products derived from this software
  19  * without specific prior written permission.
  20  *
  21  *
  22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER
  26  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33  */
  34 #ifndef __FTMOD_SANGOMA_ISDN_USER_H__
  35 #define __FTMOD_SANGOMA_ISDN_USER_H__
  36 
  37 
  38 #define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
  39 #define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type);
  40 #define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX)                 \
  41         _TYPE _FUNC1 (const char *name)                                                                         \
  42         {                                                                                                                                       \
  43                 int i;                                                                                                                  \
  44                 _TYPE t = _MAX ;                                                                                                \
  45                                                                                                                                                 \
  46                 for (i = 0; i < _MAX ; i++) {                                                                   \
  47                         if (!strcasecmp(name, _STRINGS[i])) {                                           \
  48                                 t = (_TYPE) i;                                                                                  \
  49                                 break;                                                                                                  \
  50                         }                                                                                                                       \
  51                 }                                                                                                                               \
  52                 return t;                                                                                                               \
  53         }                                                                                                                                       \
  54         const char * _FUNC2 (_TYPE type)                                                                        \
  55         {                                                                                                                                       \
  56                 if (type > _MAX) {                                                                                              \
  57                         type = _MAX;                                                                                            \
  58                 }                                                                                                                               \
  59                 return _STRINGS[(int)type];                                                                             \
  60         }                                                                                                                                       \
  61 
  62 
  63 typedef enum {
  64         /* Call is not end-to-end ISDN */
  65         SNGISDN_PROGIND_DESCR_NETE_ISDN,
  66         /* Destination address is non-ISDN */
  67         SNGISDN_PROGIND_DESCR_DEST_NISDN,
  68         /* Origination address is non-ISDN */
  69         SNGISDN_PROGIND_DESCR_ORIG_NISDN,
  70         /* Call has returned to the ISDN */
  71         SNGISDN_PROGIND_DESCR_RET_ISDN,
  72         /* Interworking as occured and has resulted in a telecommunication service change */
  73         SNGISDN_PROGIND_DESCR_SERV_CHANGE,
  74         /* In-band information or an appropriate pattern is now available */
  75         SNGISDN_PROGIND_DESCR_IB_AVAIL,
  76         /* Invalid */
  77         SNGISDN_PROGIND_DESCR_INVALID,
  78 } ftdm_sngisdn_progind_descr_t;
  79 #define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid"
  80 SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t);
  81 
  82 
  83 typedef enum {
  84         /* User */
  85         SNGISDN_PROGIND_LOC_USER,
  86         /* Private network serving the local user */
  87         SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR,
  88         /* Public network serving the local user */
  89         SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR,
  90         /* Transit network */
  91         SNGISDN_PROGIND_LOC_TRANSIT_NET,
  92         /* Public network serving remote user */
  93         SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR,
  94         /* Private network serving remote user */
  95         SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR,
  96         /* Network beyond the interworking point */
  97         SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW,
  98         /* Invalid */
  99         SNGISDN_PROGIND_LOC_INVALID,
 100 } ftdm_sngisdn_progind_loc_t;
 101 #define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid"
 102 SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t);
 103 
 104 
 105 #endif /* __FTMOD_SANGOMA_ISDN_USER_H__*/
 106 
 107 /* For Emacs:
 108  * Local Variables:
 109  * mode:c
 110  * indent-tabs-mode:t
 111  * tab-width:4
 112  * c-basic-offset:4
 113  * End:
 114  * For VIM:
 115  * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
 116  */
 117 
 118 /******************************************************************************/

/* [<][>][^][v][top][bottom][index][help] */