Make groups be 64-bits (bug #3351, with mods)
authorMark Spencer <markster@digium.com>
Sat, 15 Jan 2005 21:51:38 +0000 (21:51 +0000)
committerMark Spencer <markster@digium.com>
Sat, 15 Jan 2005 21:51:38 +0000 (21:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4803 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c
channels/chan_agent.c
channels/chan_mgcp.c
channels/chan_modem.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_zap.c
include/asterisk/channel.h
include/asterisk/utils.h
include/asterisk/vmodem.h
utils.c

index 0d1c5da..1fb7295 100755 (executable)
--- a/channel.c
+++ b/channel.c
@@ -3033,13 +3033,13 @@ int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, i
        return 0;
 }
 
-unsigned int ast_get_group(char *s)
+ast_group_t ast_get_group(char *s)
 {
        char *copy;
        char *piece;
        char *c=NULL;
        int start=0, finish=0,x;
-       unsigned int group = 0;
+       ast_group_t group = 0;
        copy = ast_strdupa(s);
        if (!copy) {
                ast_log(LOG_ERROR, "Out of memory\n");
@@ -3058,8 +3058,8 @@ unsigned int ast_get_group(char *s)
                        continue;
                }
                for (x=start;x<=finish;x++) {
-                       if ((x > 31) || (x < 0)) {
-                               ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 31)\n", x);
+                       if ((x > 63) || (x < 0)) {
+                               ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 63)\n", x);
                        } else
                                group |= (1 << x);
                }
@@ -3118,3 +3118,29 @@ void ast_channels_init(void)
 {
        ast_cli_register(&cli_show_channeltypes);
 }
+
+/*--- ast_print_group: Print call group and pickup group ---*/
+char *ast_print_group(char *buf, int buflen, ast_group_t group) 
+{
+       unsigned int i;
+       int first=1;
+       char num[3];
+
+       buf[0] = '\0';
+       
+       if (!group)     /* Return empty string if no group */
+               return(buf);
+
+       for (i=0; i<=63; i++) { /* Max group is 63 */
+               if (group & (1 << i)) {
+                       if (!first) {
+                               strncat(buf, ", ", buflen);
+                       } else {
+                               first=0;
+                       }
+                       snprintf(num, sizeof(num), "%u", i);
+                       strncat(buf, num, buflen);
+               }
+       }
+       return(buf);
+}
index 8608987..87046c7 100755 (executable)
@@ -115,7 +115,7 @@ static void dump_agents(void);
 
 static int capability = -1;
 
-static unsigned int group;
+static ast_group_t group;
 static int autologoff;
 static int wrapuptime;
 static int ackcall;
@@ -151,7 +151,7 @@ static struct agent_pvt {
        time_t start;                           /* When call started */
        struct timeval lastdisc;                /* When last disconnected */
        int wrapuptime;                         /* Wrapup time in ms */
-       unsigned int group;                     /* Group memberships */
+       ast_group_t group;              /* Group memberships */
        int acknowledged;                       /* Acknowledged */
        char moh[80];                           /* Which music on hold */
        char agent[AST_MAX_AGENT];              /* Agent ID */
@@ -1110,7 +1110,7 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
        struct agent_pvt *p;
        struct ast_channel *chan = NULL;
        char *s;
-       unsigned int groupmatch;
+       ast_group_t groupmatch;
        int waitforagent=0;
        int hasagent = 0;
        struct timeval tv;
@@ -1957,7 +1957,7 @@ static int agent_devicestate(void *data)
 {
        struct agent_pvt *p;
        char *s;
-       unsigned int groupmatch;
+       ast_group_t groupmatch;
        int waitforagent=0;
        int res = AST_DEVICE_INVALID;
        
index 7065a2d..26ee4af 100755 (executable)
@@ -172,8 +172,8 @@ static int nat = 0;
 /*static int cur_signalling = -1;*/
 
 /*static unsigned int cur_group = 0;*/
-static unsigned int cur_callergroup = 0;
-static unsigned int cur_pickupgroup = 0;
+static ast_group_t cur_callergroup = 0;
+static ast_group_t cur_pickupgroup = 0;
 
 /* XXX Is this needed? */
 /*     Doesn't look like the dsp stuff for */
@@ -373,8 +373,8 @@ struct mgcp_endpoint {
        char mailbox[AST_MAX_EXTENSION];
        char musicclass[MAX_LANGUAGE];
        char curtone[80];                       /* Current tone */
-       unsigned int callgroup;
-       unsigned int pickupgroup;
+       ast_group_t callgroup;
+       ast_group_t pickupgroup;
        int callwaiting;
        int transfer;
        int threewaycalling;
index 9a1e207..6bd5c6c 100755 (executable)
@@ -74,7 +74,7 @@ struct ast_dsp *dsp = NULL;
 static char outgoingmsn[AST_MAX_EXTENSION]="";
 
 /* Default group */
-static unsigned int cur_group = 0;
+static ast_group_t cur_group = 0;
 
 static int usecnt =0;
 
@@ -790,7 +790,7 @@ static struct ast_channel *modem_request(const char *type, int format, void *dat
        struct ast_modem_pvt *p;
        struct ast_channel *tmp = NULL;
        char dev[80];
-       unsigned int group = 0;
+       ast_group_t group = 0;
        char *stringp=NULL;
        strncpy(dev, (char *)data, sizeof(dev)-1);
        stringp=dev;
@@ -848,11 +848,11 @@ static struct ast_channel *modem_request(const char *type, int format, void *dat
        return tmp;
 }
 
-static unsigned int get_group(char *s)
+static ast_group_t get_group(char *s)
 {
        char *piece;
        int start, finish,x;
-       unsigned int group = 0;
+       ast_group_t group = 0;
        char *copy = ast_strdupa(s);
        char *stringp=NULL;
        if (!copy) {
@@ -874,7 +874,7 @@ static unsigned int get_group(char *s)
                piece = strsep(&stringp, ",");
 
                for (x=start;x<=finish;x++) {
-                       if ((x > 31) || (x < 0)) {
+                       if ((x > 63) || (x < 0)) {
                                ast_log(LOG_WARNING, "Ignoring invalid group %d\n", x);
                                break;
                        }
index af185bf..57d4cc9 100755 (executable)
@@ -312,8 +312,8 @@ static struct sip_pvt {
        struct ast_codec_pref prefs; /* codec prefs */
        unsigned int ocseq;                     /* Current outgoing seqno */
        unsigned int icseq;                     /* Current incoming seqno */
-       unsigned int callgroup;                 /* Call group */
-       unsigned int pickupgroup;               /* Pickup group */
+       ast_group_t callgroup;          /* Call group */
+       ast_group_t pickupgroup;                /* Pickup group */
        int lastinvite;                         /* Last Cseq of invite */
        unsigned int flags;                     /* SIP_ flags */        
        int capability;                         /* Special capability (codec) */
@@ -433,8 +433,8 @@ struct sip_user {
        char musicclass[MAX_LANGUAGE];  /* Music on Hold class */
        char useragent[256];            /* User agent in SIP request */
        struct ast_codec_pref prefs; /* codec prefs */
-       unsigned int callgroup;         /* Call group */
-       unsigned int pickupgroup;       /* Pickup Group */
+       ast_group_t callgroup;  /* Call group */
+       ast_group_t pickupgroup;        /* Pickup Group */
        unsigned int flags;             /* SIP_ flags */        
        int amaflags;                   /* AMA flags for billing */
        int callingpres;                /* Calling id presentation */
@@ -475,8 +475,8 @@ struct sip_peer {
        int rtptimeout;
        int rtpholdtimeout;
        int rtpkeepalive;                       /* Send RTP packets for keepalive */
-       unsigned int callgroup;         /* Call group */
-       unsigned int pickupgroup;       /* Pickup group */
+       ast_group_t callgroup;  /* Call group */
+       ast_group_t pickupgroup;        /* Pickup group */
        struct sockaddr_in addr;        /* IP address of peer */
        struct in_addr mask;
 
index 9a3fa48..cb2319c 100755 (executable)
@@ -492,8 +492,8 @@ static char cid_num[AST_MAX_EXTENSION] = "";
 static char cid_name[AST_MAX_EXTENSION] = "";
 static char linelabel[AST_MAX_EXTENSION] ="";
 static int nat = 0;
-static unsigned int cur_callergroup = 0;
-static unsigned int cur_pickupgroup = 0;
+static ast_group_t cur_callergroup = 0;
+static ast_group_t cur_pickupgroup = 0;
 static int immediate = 0;
 static int callwaiting = 0;
 static int callreturn = 0;
@@ -642,8 +642,8 @@ struct skinny_line {
        char mailbox[AST_MAX_EXTENSION];
        char musicclass[MAX_LANGUAGE];
        int curtone;                                    /* Current tone being played */
-       unsigned int callgroup;
-       unsigned int pickupgroup;
+       ast_group_t callgroup;
+       ast_group_t pickupgroup;
        int callwaiting;
        int transfer;
        int threewaycalling;
index 3d8741d..292dfc1 100755 (executable)
@@ -172,9 +172,9 @@ static int cid_start = CID_START_RING;
 static int zaptrcallerid = 0;
 static int cur_signalling = -1;
 
-static unsigned int cur_group = 0;
-static unsigned int cur_callergroup = 0;
-static unsigned int cur_pickupgroup = 0;
+static ast_group_t cur_group = 0;
+static ast_group_t cur_callergroup = 0;
+static ast_group_t cur_pickupgroup = 0;
 static int relaxdtmf = 0;
 
 static int immediate = 0;
@@ -489,8 +489,8 @@ static struct zt_pvt {
        int confno;                                     /* Our conference */
        int confusers;                          /* Who is using our conference */
        int propconfno;                         /* Propagated conference number */
-       unsigned int callgroup;
-       unsigned int pickupgroup;
+       ast_group_t callgroup;
+       ast_group_t pickupgroup;
        int immediate;                          /* Answer before getting digits? */
        int channel;                            /* Channel Number or CRV */
        int span;                                       /* Span number */
index 4d24150..ddff8a3 100755 (executable)
@@ -46,6 +46,8 @@ extern "C" {
 
 #define AST_MAX_FDS 8
 
+typedef unsigned long long ast_group_t;
+
 struct ast_generator {
        void *(*alloc)(struct ast_channel *chan, void *params);
        void (*release)(struct ast_channel *chan, void *data);
@@ -887,7 +889,10 @@ static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
                                                                        ast_set_flag(c, AST_FLAG_BLOCKING); \
                                                                        } }
 
-extern unsigned int ast_get_group(char *s);
+extern ast_group_t ast_get_group(char *s);
+/* print call- and pickup groups into buffer */
+extern char *ast_print_group(char *buf, int buflen, ast_group_t group);
+
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }
index ff0c2cb..dd11419 100755 (executable)
@@ -153,6 +153,3 @@ extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*s
 extern char *ast_strcasestr(const char *, const char *);
 
 #endif
-
-/* print call- and pickup groups into buffer */
-char *ast_print_group(char *buf, int buflen, unsigned int group);
index c4f271d..61e0311 100755 (executable)
@@ -116,7 +116,7 @@ struct ast_modem_pvt {
        /*! Multiple Subscriber Number we accept for outgoing calls (; seperated list) */
        char outgoingmsn[AST_MAX_EXTENSION];    
        /*! Group(s) we belong to if available */
-       unsigned int group;
+       ast_group_t group;
        /*! Caller ID if available */
        char cid_name[AST_MAX_EXTENSION];       
        /*! Caller ID if available */
diff --git a/utils.c b/utils.c
index 55d9154..b11ef27 100755 (executable)
--- a/utils.c
+++ b/utils.c
@@ -430,30 +430,3 @@ char *ast_strcasestr(const char *haystack, const char *needle)
        }
 }
 #endif
-
-
-/*--- ast_print_group: Print call group and pickup group ---*/
-char *ast_print_group(char *buf, int buflen, unsigned int group) 
-{
-       unsigned int i;
-       int first=1;
-       char num[3];
-
-       buf[0] = '\0';
-       
-       if (!group)     /* Return empty string if no group */
-               return(buf);
-
-       for (i=0; i<=31; i++) { /* Max group is 31 */
-               if (group & (1 << i)) {
-                       if (!first) {
-                               strncat(buf, ", ", buflen);
-                       } else {
-                               first=0;
-                       }
-                       snprintf(num, sizeof(num), "%u", i);
-                       strncat(buf, num, buflen);
-               }
-       }
-       return(buf);
-}