[asterisk-commits] [svn-commits] branch mogorman/asterisk-xmpp
r17777 - /team/mogorman/asterisk-xmpp/res/stun/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Apr 6 01:36:33 MST 2006
Author: mogorman
Date: Thu Apr 6 03:36:32 2006
New Revision: 17777
URL: http://svn.digium.com/view/asterisk?rev=17777&view=rev
Log:
wow the wrapper works now ^_^. Now all I have
to do is write the functions.
Modified:
team/mogorman/asterisk-xmpp/res/stun/Makefile
team/mogorman/asterisk-xmpp/res/stun/main.c
team/mogorman/asterisk-xmpp/res/stun/stunwrapper.cpp
Modified: team/mogorman/asterisk-xmpp/res/stun/Makefile
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/stun/Makefile?rev=17777&r1=17776&r2=17777&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/stun/Makefile (original)
+++ team/mogorman/asterisk-xmpp/res/stun/Makefile Thu Apr 6 03:36:32 2006
@@ -15,7 +15,7 @@
#LDFLAGS+= -lnsl -lsocket
-all: client libstunwrapper
+all: client libstunwrapper test
clean:
- rm *.o client
@@ -30,6 +30,9 @@
libstun.a: stun.o udp.o
ar rv $@ $<
+test:
+ gcc main.c libstunwrapper.a -lstdc++
+
libstunwrapper: stunwrapper.o
ar crv libstunwrapper.a stunwrapper.o
Modified: team/mogorman/asterisk-xmpp/res/stun/main.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/stun/main.c?rev=17777&r1=17776&r2=17777&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/stun/main.c (original)
+++ team/mogorman/asterisk-xmpp/res/stun/main.c Thu Apr 6 03:36:32 2006
@@ -1,7 +1,15 @@
#include <stdio.h>
int main() {
+ void *hott, *cold;
+ hott=gethead();
+ cold = insertstun();
printf("HELLO \n");
- printf("HELLO %d\n",CgetSrcPort());
+ printf("HELLO %d\n",getSrcPort(hott));
+ printf("HELLO %d\n",getSrcPort(cold));
+ setSrcPort(cold,7);
+ setSrcPort(hott,4);
+ printf("HELLO %d\n",getSrcPort(hott));
+ printf("HELLO %d\n",getSrcPort(cold));
return 0;
}
Modified: team/mogorman/asterisk-xmpp/res/stun/stunwrapper.cpp
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/res/stun/stunwrapper.cpp?rev=17777&r1=17776&r2=17777&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/res/stun/stunwrapper.cpp (original)
+++ team/mogorman/asterisk-xmpp/res/stun/stunwrapper.cpp Thu Apr 6 03:36:32 2006
@@ -8,14 +8,47 @@
#include "udp.h"
#include "stun.h"
+struct Node {
+ StunAddress4 stunServerAddr;
+ int srcPort;
+ Node *next;
+};
+
class stunwrapper {
+ public:
+ stunwrapper(void)
+ {
+ head = (struct Node *)malloc(sizeof(struct Node));
+ memset(head, 0, sizeof(struct Node));
+ head->srcPort = 0;
+ };
+
+ int getSrcPort(Node *mynode)
+ {
+ return mynode->srcPort;
+ };
+
+ void setSrcPort(Node *mynode,int i)
+ {
+ mynode->srcPort = i;
+ };
+
+ void *gethead()
+ {
+ return head;
+ }
+ void *addpointer()
+ {
+ Node *newnode;
+ newnode = (struct Node *)malloc(sizeof(struct Node));
+ memset(newnode, 0, sizeof(struct Node));
+ newnode->next = head;
+ head = newnode;
+ return head;
+ };
+
private:
- StunAddress4 stunServerAddr;
- int srcPort;
- public:
- stunwrapper(void){srcPort=0;};
- int getSrcPort(void){ return srcPort+1;};
- stunwrapper *next;
+ Node *head;
} wrapper;
@@ -23,15 +56,24 @@
void * insertstun()
{
- stunwrapper newrapper;
- newrapper->next = wrapper;
- wrapper=newwrapper;
- return wrapper;
+ return wrapper.addpointer();
}
- int CgetSrcPort()
+ int getSrcPort(void *pointer)
{
- return wrapper.getSrcPort();
+ Node *mynode = (struct Node *)pointer;
+ return wrapper.getSrcPort(mynode);
+ }
+
+ void setSrcPort(void *pointer, int i)
+ {
+ Node *mynode = (struct Node *)pointer;
+ wrapper.setSrcPort(mynode, i);
+ }
+
+ void *gethead()
+ {
+ return wrapper.gethead();
}
}
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
svn-commits mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/svn-commits
More information about the asterisk-commits
mailing list