[Home]

Summary:ASTERISK-03026: [patch] Use bit masking with options in sip_pvt, sip_user, and sip_peer
Reporter:Russell Bryant (russell)Labels:
Date Opened:2004-12-18 01:12:36.000-0600Date Closed:2008-01-15 15:17:11.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) sipflags.diff.txt
( 1) sipflags2.diff.txt
Description:This patch uses bit masking for a number of the variables within sip_pvt, sip_user, and sip_peer.  It makes use of the flag macros in utils.h.

This gets rid of 12/3/7 int's in sip_pvt/sip_user/sip_peer.

****** ADDITIONAL INFORMATION ******

Disclaimer is on file
Comments:By: Olle Johansson (oej) 2004-12-18 03:47:22.000-0600

Finally!

Thank you!

/Olle

By: Mark Spencer (markster) 2004-12-18 08:21:41.000-0600

Looks nice, one suggestion though -- if you use the copy_flags instead of set2flag +test_flag you can probably cut a few lines and make it a little faster, too.

By: Russell Bryant (russell) 2004-12-18 23:47:21.000-0600

I got rid of all the lines that were using ast_set2_flag and ast_test_flag in the same line.

I added global_flags to compact some of the global options.  I added a struct, ast_flags, as the type for this.

Let me know what you think.

By: Kevin P. Fleming (kpfleming) 2004-12-19 15:04:16.000-0600

OK, so now you've done one of the two steps I suggested in the other bug <G>... struct ast_flags is a useful thing, for sure.

Before we spread this too much farther throughout the code base, I'll suggest again that struct ast_flags be the _only_ type allowed to store flags, and the macros converted back to static inlines.

The pain of this will be that all current references of the form:

 ast_test_flag(chan, FLAG_FOO)

will need to become

 ast_test_flag(&chan->flags, FLAG_FOO)

so that the variable being passed is actually of "struct ast_flags *" type. I know, this is more wordy, but I think the compile-time type-checking is worth it, especially if we do it now before too many other modules are converted. I've already got a patch for app_queue (bug 3092) that I'll be happy to rev with this change :-)

By: Mark Spencer (markster) 2004-12-19 15:36:11.000-0600

I disagree.  I like the macro piece because that way all you have to do is add an int flags into your struct to be able to use it and the references are always directly on the given structure.  It's kind a shame that we have to have a particular global structure for the flags, but oh well.

By: Mark Spencer (markster) 2004-12-19 15:49:01.000-0600

Added to CVS head with small optimizations, nicely done!

By: Russell Bryant (russell) 2004-12-19 20:57:03.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:17:11.000-0600

Repository: asterisk
Revision: 4487

U   trunk/channels/chan_sip.c
U   trunk/include/asterisk/utils.h

------------------------------------------------------------------------
r4487 | markster | 2008-01-15 15:17:11 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge drumkilla's bitfield patch for SIP (bug ASTERISK-3026)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4487