[asterisk-scf-commits] team/kpfleming/fosdem2011.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Feb 7 18:47:39 CST 2011


branch "master" has been updated
       via  2496daf5cb9635b42b8b82b6d97de09b581c7641 (commit)
       via  78ad76304e3a98dbbe1145b4f63268f8e4d8a830 (commit)
       via  ded5b7e9199c09c5b0c627b53b180e4c19952c6e (commit)
       via  a055b6f80739c09abdd36b52db146c4dc4b6e2b7 (commit)
      from  ae33998f390fc8b1b3e1e42ce0a689d66edbdfa4 (commit)

Summary of changes:
 .gitignore    |    1 +
 Makefile      |    5 ++++-
 fred.cpp      |    6 +++---
 fred.cs       |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fred.java     |    6 ++----
 fred.py       |    7 ++-----
 fredHook.java |    1 -
 7 files changed, 69 insertions(+), 14 deletions(-)
 create mode 100644 fred.cs


- Log -----------------------------------------------------------------
commit 2496daf5cb9635b42b8b82b6d97de09b581c7641
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Feb 7 13:52:02 2011 +0100

    And now for completeness... a C# example.

diff --git a/.gitignore b/.gitignore
index fc11bf7..297800c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.class
 *.pyc
 fred
+fred.exe
diff --git a/Makefile b/Makefile
index 4dd811e..93daeb0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,10 @@
 export CLASSPATH=/home/kpfleming/git/asterisk-scf/fosdem:/home/kpfleming/git/asterisk-scf/gitall/slice/java/asterisk-scf-api.jar:/opt/Ice-3.4/lib/Ice.jar
 export PYTHONPATH=/opt/Ice-3.4/python:/home/kpfleming/git/asterisk-scf/gitall/slice/python
 
-all: fred.class fred.pyc fred
+all: fred.class fred.pyc fred fred.exe
+
+fred.exe: fred.cs
+	gmcs -out:$@ -t:exe -lib:/opt/Ice-3.4/bin -lib:/home/kpfleming/git/asterisk-scf/gitall/slice/mono -r:Ice -r:AsteriskSCF-API $<
 
 fred: fred.cpp
 	g++ -o $@ -I/opt/Ice-3.4/include -I/usr/local/include -L/opt/Ice-3.4/lib64 -L/usr/local/lib -lIce -lIceUtil -lasterisk-scf-api $<
diff --git a/fred.cs b/fred.cs
new file mode 100644
index 0000000..e7338e8
--- /dev/null
+++ b/fred.cs
@@ -0,0 +1,57 @@
+using System;
+using AsteriskSCF.System.Hook.V1;
+using AsteriskSCF.SIP.ExtensionPoint.V1;
+
+public class Fred : Ice.Application
+{
+	public class Hook : AuthHookDisp_
+	{
+		public static Ice.ObjectAdapter _adapter;
+		public AuthHookPrx _proxy;
+
+		public Hook()
+		{
+			_proxy = AuthHookPrxHelper.uncheckedCast(_adapter.addWithUUID(this));
+		}
+
+		public override HookResult challengeRequest(RequestInfo info, out DigestChallenge[] challenges, Ice.Current current)
+		{
+			HookResult result = new HookResult();
+			DigestChallenge challenge = new DigestChallenge();
+
+			challenge.username = "bob";
+			challenge.password = "alice";
+			challenge.domain = new String[]{ "example.com" };
+			challenge.algorithm = DigestAlgorithm.AKAv1MD5;
+
+			challenges = new DigestChallenge[]{ challenge };
+			result.status = HookStatus.Succeeded;
+
+			return result;
+		}
+	}
+
+	public override int run(string[] args)
+	{
+		Ice.ObjectAdapter adapter = communicator().createObjectAdapter("fred");
+		adapter.activate();
+		Hook._adapter = adapter;
+		
+		Hook hook = new Hook();
+		
+		// this sample code does not actually locate the target SIP component
+		AuthExtensionPointPrx epPrx = AuthExtensionPointPrxHelper.uncheckedCast(communicator().stringToProxy("sip_component"));
+		HookId _hookId = epPrx.addAuthHook(hook._proxy, new RequestType[]{ RequestType.DialogEstablishing });
+		
+		communicator().waitForShutdown();
+		epPrx.removeAuthHook(_hookId);
+		
+		return 0;
+	}
+
+	public static void Main(string[] args)
+	{
+		Fred app = new Fred();
+		Environment.Exit(app.main(args));
+	}
+}

commit 78ad76304e3a98dbbe1145b4f63268f8e4d8a830
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Feb 7 13:50:59 2011 +0100

    hookId is not a member variable, so don't use an underscore prefix.
    
    Whitespace cleanup to be consistent with other examples.

diff --git a/fred.java b/fred.java
index 563f2f7..8437b37 100644
--- a/fred.java
+++ b/fred.java
@@ -3,8 +3,6 @@ import AsteriskSCF.SIP.ExtensionPoint.V1.*;
 
 public class fred extends Ice.Application
 {
-    private HookId _hookId;
-
     public int run(String[] args)
     {
 	Ice.ObjectAdapter adapter = communicator().createObjectAdapter("fred");
@@ -15,10 +13,10 @@ public class fred extends Ice.Application
 
 	// this sample code does not actually locate the target SIP component
 	AuthExtensionPointPrx epPrx = AuthExtensionPointPrxHelper.uncheckedCast(communicator().stringToProxy("sip_component"));
-	_hookId = epPrx.addAuthHook(hook._proxy, new RequestType[]{ RequestType.DialogEstablishing });
+	HookId hookId = epPrx.addAuthHook(hook._proxy, new RequestType[]{ RequestType.DialogEstablishing });
 
 	communicator().waitForShutdown();
-	epPrx.removeAuthHook(_hookId);
+	epPrx.removeAuthHook(hookId);
 
 	return 0;
     }
diff --git a/fredHook.java b/fredHook.java
index f0800c5..973aa4e 100644
--- a/fredHook.java
+++ b/fredHook.java
@@ -22,7 +22,6 @@ public class fredHook extends _AuthHookDisp
 	challenge.algorithm = DigestAlgorithm.AKAv1MD5;
 
 	challengeSeq.value = new DigestChallenge[]{ challenge };
-
 	result.status = HookStatus.Succeeded;
 
 	return result;

commit ded5b7e9199c09c5b0c627b53b180e4c19952c6e
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Feb 7 13:50:30 2011 +0100

    hookId is not a member variable, so don't use an underscore prefix.
    
    Whitespace cleanup to be consistent with other examples.

diff --git a/fred.py b/fred.py
index b548d05..269024f 100644
--- a/fred.py
+++ b/fred.py
@@ -19,14 +19,11 @@ class fredHook(AuthHook):
 	challenge.algorithm = DigestAlgorithm.AKAv1MD5
 
         challenges = [ challenge ]
-
         result.status = HookStatus.Succeeded
 
         return result
 
 class fred(Ice.Application):
-    _hookId = None
-
     def run(self, args):
         adapter = self.communicator().createObjectAdapter("fred")
         adapter.activate()
@@ -36,10 +33,10 @@ class fred(Ice.Application):
 
         # this sample code does not actually locate the target SIP component
         epPrx = AuthExtensionPointPrx.uncheckedCast(communicator().stringToProxy("sip_component"))
-        _hookId = epPrx.addAuthHook(hook._proxy, [ RequestType.DialogEstablishing ])
+        hookId = epPrx.addAuthHook(hook._proxy, [ RequestType.DialogEstablishing ])
 
         self.communicator().waitForShutdown()
-	epPrx.removeAuthHook(_hookId)
+	epPrx.removeAuthHook(hookId)
 
         return 0
 

commit a055b6f80739c09abdd36b52db146c4dc4b6e2b7
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Feb 7 13:49:40 2011 +0100

    hookId is not a member variable, so don't use an underscore prefix.
    
    Whitespace cleanup to be consistent with other examples.

diff --git a/fred.cpp b/fred.cpp
index 79ec162..490aa44 100644
--- a/fred.cpp
+++ b/fred.cpp
@@ -29,8 +29,8 @@ struct fredHook : virtual public AuthHook
 		challenge->algorithm = AKAv1MD5;
 
 		challenges.push_back(challenge);
-
 		result.status = Succeeded;
+
 		return result;
 	}
 };
@@ -48,10 +48,10 @@ struct fred : virtual public Ice::Application
 		AuthExtensionPointPrx epPrx = AuthExtensionPointPrx::uncheckedCast(communicator()->stringToProxy("sip_component"));
 		RequestTypeSeq requestTypes;
 		requestTypes.push_back(DialogEstablishing);
-		HookId _hookId = epPrx->addAuthHook(hook->_proxy, requestTypes);
+		HookId hookId = epPrx->addAuthHook(hook->_proxy, requestTypes);
 
 		communicator()->waitForShutdown();
-		epPrx->removeAuthHook(_hookId);
+		epPrx->removeAuthHook(hookId);
 
 		return 0;
 	}

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


-- 
team/kpfleming/fosdem2011.git



More information about the asterisk-scf-commits mailing list