[OpenSER-Devel] [ openser-Patches-1775285 ] Add new assignment operator (:=) to config script

SourceForge.net noreply at sourceforge.net
Thu Aug 23 10:43:05 CEST 2007


Patches item #1775285, was opened at 2007-08-16 12:43
Message generated for change (Comment added) made by miconda
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1775285&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
>Group: ver devel
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: axlh (axlh)
>Assigned to: Daniel-Constantin Mierla (miconda)
Summary: Add new assignment operator (:=) to config script

Initial Comment:
find attached a patch which adds a new assignment operator (:=) to the config 
script. Instead of the regular assignment (=), this operator will not add an 
entry to an existing avp, but it deletes the existing avp and creates a new 
avp with only one value.

I think this is usefull because I was using a lot of avp_delete()/assignment 
sequences to keep just 1 value in an avp instead of a list.

Please review and comment on it. Although the patch seems to work ok, I don't 
have any insight in the pointer dances OpenSER does, so I might have done 
something completely insane.

If the patch is acceptable as is, please commit.

Patch is against OpenSER 1.2 svn revision 2606


Config example and result:
route {
        xlog("Part 1");
        $avp(s:test1) = "test1_1";
        $avp(s:test1) = "test1_2";
        $avp(s:test2) := "test2_1";
        $avp(s:test2) := "test2_2";
        avp_print();

        xlog("Part 2");
        $avp(s:test1) := "test1_3";
        $avp(s:test2) = "test2_3";
        avp_print();
}

Log snippet:

[19924]: Part 1
[19924]: INFO:avpops:print_avp: p=0xb5c4fbc0, flags=0x0003
[19924]: INFO:                      name=<test2>
[19924]: INFO:                      val_str=<test2_2 / 7>
[19924]: INFO:avpops:print_avp: p=0xb5c4fb90, flags=0x0003
[19924]: INFO:                      name=<test1>
[19924]: INFO:                      val_str=<test1_2 / 7>
[19924]: INFO:avpops:print_avp: p=0xb5c4fb60, flags=0x0003
[19924]: INFO:                      name=<test1>
[19924]: INFO:                      val_str=<test1_1 / 7>
[19924]: Part 2
[19924]: INFO:avpops:print_avp: p=0xb5c4fb90, flags=0x0003
[19924]: INFO:                      name=<test2>
[19924]: INFO:                      val_str=<test2_3 / 7>
[19924]: INFO:avpops:print_avp: p=0xb5c4fb60, flags=0x0003
[19924]: INFO:                      name=<test1>
[19924]: INFO:                      val_str=<test1_3 / 7>
[19924]: INFO:avpops:print_avp: p=0xb5c4fbc0, flags=0x0003
[19924]: INFO:                      name=<test2>
[19924]: INFO:                      val_str=<test2_2 / 7>
______________________________________________
Devel mailing list
Devel at openser.org
http://openser.org/cgi-bin/mailman/listinfo/devel

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

>Comment By: Daniel-Constantin Mierla (miconda)
Date: 2007-08-23 11:43

Message:
Logged In: YES 
user_id=1246013
Originator: NO

I applied the patch with some changes:
- all existing avps with same name are deleted, and therefore, after this
assignment there will be only one. It looks to me less exposed to
confusions for admins. Let me know if that is fine with you
- in addition, :=null is same as delete all avps with that name

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1775285&group_id=139143



More information about the Devel mailing list