[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-users] how to change interface network from lo to ppp0
From: |
rezakahar |
Subject: |
Re: [Linphone-users] how to change interface network from lo to ppp0 |
Date: |
Sat, 10 Apr 2004 02:19:52 +0700 |
Hi,
Thank you for the answer
but, i'm sorry because i'm newby about this
by the way, thomas pang has modification like this, how to use this
modification? i've sent email to tomas phang, but he didn't answer me :
The user agent program that I am using for this project is linphone-0.9.1
which
can be downloaded http://simon.morlat.free.fr/download (last access March
16,
2003). The following files under linphone-0.9.1/osipua/src are modified:
· Makefile: Script for compiling the program
· osipmanager.c: User agent configuration, initialization and release.
· osipua.h: Header file of the oSIP user agent
· udp.c: It contains functions for handling the UDP transport. Here I
modify it to handle SCTP transport instead.
· udp.h: Header file of udp.c
To list the changes I made, I rename the original src to src.org and the
modified
src to src.sctp, and use the following command to capture the differences to
a file
called diff.log as listed below: diff -r src.org src.sctp > diff.log
diff.log:
diff -r src.org/Makefile src.sctp/Makefile
63c63
< host_triplet = i686-pc-linux-gnu
---
> host_triplet = i586-pc-linux-gnu
129,130c129,130
< -lpthread -lnsl
<
---
> -lpthread -lnsl
> #-lpthread -lnsl -lsctpsocket -lsctp -lglib -lstdc++
134c134,140
< INCLUDES = -I$(top_srcdir) -I$(osip_prefix)/include
---
> SCTP=/home/tkpang/lksctp-2_4_18-0_4_6
> SCTP_INCL = -I$(SCTP)/test/libc/include -I$(SCTP)/test -D_LKSCTP
>
> #INCLUDES = -I$(top_srcdir) -I$(osip_prefix)/include
> #DEFS = -DHAVE_CONFIG_H -DENABLE_DEBUG -g -D_SCTPLIB
> INCLUDES = -I$(top_srcdir) -I$(osip_prefix)/include $(SCTP_INCL)
> DEFS = -DHAVE_CONFIG_H -DENABLE_DEBUG -g -D_DEBUG
136d141
< DEFS = -DHAVE_CONFIG_H -DENABLE_DEBUG -g
diff -r src.org/osipmanager.c src.sctp/osipmanager.c
132a133,138
> #ifdef _DEBUG
> printf("[Thomas] osip_manager_add_udpport port: %d\n", port);
> printf("[Thomas] osip_manager_add_udpport send_port: %d\n",
> manager->send_port);
> #endif
>
144,147c150,159
< newfd = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
<
< laddr.sin_addr.s_addr = htons (INADDR_ANY);
< laddr.sin_port = htons ((short) port);
---
> #ifdef _SCTPLIB
> newfd = ext_socket (PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
> #else
> newfd = socket (PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
> #endif
>
> // laddr.sin_addr.s_addr = htons (INADDR_ANY);
> // laddr.sin_port = htons ((short) port);
> laddr.sin_addr.s_addr = INADDR_ANY;
> laddr.sin_port = htons (port);
149,150c161,165
< if (bind (newfd, (struct sockaddr *) &laddr, sizeof (laddr)) <
< 0)
---
> #ifdef _SCTPLIB
> if (ext_bind (newfd, (struct sockaddr *) &laddr, sizeof (laddr)) < 0)
> #else
> if (bind (newfd, (struct sockaddr *) &laddr, sizeof (laddr)) < 0)
> #endif
156a172,189
>
> // Thomas
> #ifdef _SCTPLIB
> if (ext_listen(newfd,0)<0)
> #else
> if (listen(newfd,0)<0)
> #endif
> {
> osip_trace (OSIP_ERROR,
> ("Failed to listen socket !\n"));
> close (newfd);
> return -errno;
> }
>
> #ifdef _SCTPLIB
> // err = ext_setsockopt (newfd, SOL_SOCKET, SO_REUSEADDR,
> // (void *) &option, sizeof (option));
> #else
158a192
> #endif
360a395,399
> #ifdef _DEBUG
> printf("[Thomas] manager->send_port: %d\n", manager->send_port);
> printf("[Thomas] port: %d\n", port);
> #endif
>
367,370c406,419
< newfd = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
<
< laddr.sin_addr.s_addr = htons (INADDR_ANY);
< laddr.sin_port = htons ((short) port);
---
> #ifdef _SCTPLIB
> newfd = ext_socket (PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
> #else
> newfd = socket (PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
> #endif
>
> #ifdef _DEBUG
> printf("[Thomas] newfd: %d\n", newfd);
> #endif
>
> // laddr.sin_addr.s_addr = htons (INADDR_ANY);
> // laddr.sin_port = htons ((short) port);
> laddr.sin_addr.s_addr = INADDR_ANY;
> laddr.sin_port = htons (port);
371a421,423
> #ifdef _SCTPLIB
> if (ext_bind (newfd, (struct sockaddr *) &laddr, sizeof (laddr)) < 0)
> #else
372a425
> #endif
378a432,435
> #ifdef _SCTPLIB
----- O
> // err = ext_setsockopt (newfd, SOL_SOCKET, SO_REUSEADDR, (void *)
&option,
> // sizeof (option));
> #else
380a438
> #endif
383a442,453
> // Thomas
> #ifdef _SCTPLIB
> if (ext_listen(newfd,0)<0)
> #else
> if (listen(newfd,0)<0)
> #endif
> {
> osip_trace (OSIP_ERROR, ("Failed to listen socket !\n"));
> close (newfd);
> return -errno;
> }
>
diff -r src.org/osipua.h src.sctp/osipua.h
39d38
<
Only in src.sctp: tags
diff -r src.org/udp.c src.sctp/udp.c
40a41,45
>
> #ifdef _DEBUG
> printf("[Thomas] ev->type = %d\n", ev->type);
> printf("[Thomas] return value of osip_find_transaction_and_add_event:
%d\n", err);
> #endif
118a124
>
130a137,147
> struct sockaddr_in remote_addr;
> int length;
>
> #ifdef _LKSCTP
> struct msghdr msg;
> struct iovec iov;
> struct SCTP_cmsghdr cmsghdr;
> char *data;
> union sctp_notification *sn;
> #endif
>
133a151,154
> #ifdef _SCTPLIB
> nb = ext_select (manager->max_udpfd + 1, &osipfdset, NULL, NULL,
> &timeout);
> #else
135a157
> #endif
150a173,190
>
> length = sizeof(remote_addr);
> #ifdef _SCTPLIB
> i = ext_recvfrom(manager->udpfds[j], manager->udp_buf,
> SIP_MESSAGE_MAX_LENGTH, 0,
> (struct sockaddr *)&remote_addr, &length);
> #else
> iov.iov_base = manager->udp_buf;
> iov.iov_len = SIP_MESSAGE_MAX_LENGTH+1;
> msg.msg_iov = &iov;
> msg.msg_iovlen = 1;
> msg.msg_control = &cmsghdr;
> msg.msg_controllen = sizeof(cmsghdr);
> msg.msg_name = (void *) &remote_addr;
> msg.msg_namelen = length;
> i = recvmsg(manager->udpfds[j], &msg, MSG_WAITALL);
> #endif
> /*
153a194
> */
159a201,205
> #ifdef _DEBUG & _LKSCTP
> printf("[Thomas] msg.msg_flags: 0x%x\n", msg.msg_flags);
> printf("[Thomas] length of recv msg: %d\n", i);
> #endif
>
162a209,213
>
> #ifdef _LKSCTP
> if (!(msg.msg_flags & MSG_NOTIFICATION))
> {
> #endif
164a216,220
>
> #ifdef _DEBUG
> printf("[Thomas] sipevent: %d\n", sipevent);
> printf("[Thomas] sipevent type: %d\n", sipevent->type);
> #endif
166a223,226
> else
> #ifdef _DEBUG
> printf("[Thomas] osip_parse error\n");
> #endif
168c228,232
<
---
> #ifdef _LKSCTP
> }
> else
> printf("info: receiving SCTP ctrl msg\n");
> #endif
188a253,259
>
> #ifdef _LKSCTP
> struct msghdr msg;
> struct iovec iov;
> struct SCTP_cmsghdr cmsghdr;
> #endif
>
212c283,284
< if (0 > sendto (sock, (const void *) message, strlen (message), 0,
---
> #ifdef _SCTPLIB
> if (0 > ext_sendto (sock, (const void *) message, strlen (message), 0,
213a286,296
> #else
> iov.iov_base = message;
> iov.iov_len = strlen(message)+1;
> msg.msg_iov = &iov;
> msg.msg_iovlen = 1;
> msg.msg_control = NULL;
> msg.msg_controllen = 0;
> msg.msg_name = &addr;
> msg.msg_namelen = sizeof(addr);
> if (sendmsg(sock, &msg, 0) < 0)
> #endif
diff -r src.org/udp.h src.sctp/udp.h
20a21,29
> #ifdef _SCTPLIB
> #include "/usr/local/include/ext_socket.h"
> #endif
>
> #ifdef _LKSCTP
> #include <netinet/sctp.h>
> #include <sctp_lib.h>
> #endif
>
Original Message -----
From: "Jamey Hicks" <address@hidden>
To: "rezakahar" <address@hidden>
Cc: "Simon MORLAT" <address@hidden>; <address@hidden>
Sent: Saturday, April 10, 2004 1:01 AM
Subject: Re: [Linphone-users] how to change interface network from lo to
ppp0
> rezakahar wrote:
>
> >Hi,
> >I'd like to use linphone, but it runs on transport layer using STCP. As
we
> >know, Linphone is using UDP.
> >Any Idea about this, Linphone runs on SCTP? I need it for my research
> >Or do you know any application using SCTP as transport layer?
> >BTW, there is some one (Thomas Pang, did it for his thesis Master)have
used
> >Linphone using SCTP as transport layer, and he did some modification in
> >linphone, but until know, i don't understand about his modification
> >
> >
> >
> Linphone uses UDP. It would have to be modified to use SCTP. Perhaps
> Thomas Pang would send you a patch or a copy of his code containing the
> modifications. If you know how to program UDP socket layer in Linux, it
> would not be too difficult for you to make the modification to Linphone.
>
> Oh, now I understand the subject line -- you want to run ppp over sctp?
> Wouldn't it be better to use a more direct encapsulation, like IP GRE?
>
> Jamey
>
>