remove support for Symbian OS
This commit is contained in:
parent
95b1a99b56
commit
043aa32cc2
21 changed files with 1 additions and 2707 deletions
|
@ -130,7 +130,7 @@ Supported platforms:
|
|||
* FreeBSD
|
||||
* OpenBSD
|
||||
* NetBSD
|
||||
* Symbian OS
|
||||
* Symbian OS (not supported)
|
||||
* Solaris
|
||||
* Windows
|
||||
* Apple Mac OS X and iOS
|
||||
|
|
|
@ -129,9 +129,3 @@ void net_conn_stop(void);
|
|||
/* Net strings */
|
||||
const char *net_proto2name(int proto);
|
||||
const char *net_af2name(int af);
|
||||
|
||||
|
||||
/* todo: this does not really belong here.. */
|
||||
#ifdef __SYMBIAN32__
|
||||
int kerr2errno(int kerr);
|
||||
#endif
|
||||
|
|
|
@ -84,13 +84,6 @@ int tcp_connect(struct tcp_conn **tcp, const struct sa *peer,
|
|||
int tcp_local_get(const struct tcp_sock *ts, struct sa *local);
|
||||
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
struct RSocketServ;
|
||||
struct RConnection;
|
||||
void tcp_rconn_set(struct RSocketServ *sockSrv, struct RConnection *rconn);
|
||||
#endif
|
||||
|
||||
|
||||
/* Helper API */
|
||||
typedef bool (tcp_helper_estab_h)(int *err, bool active, void *arg);
|
||||
typedef bool (tcp_helper_send_h)(int *err, struct mbuf *mb, void *arg);
|
||||
|
|
|
@ -56,10 +56,3 @@ int udp_register_helper(struct udp_helper **uhp, struct udp_sock *us,
|
|||
void *arg);
|
||||
int udp_send_helper(struct udp_sock *us, const struct sa *dst,
|
||||
struct mbuf *mb, struct udp_helper *uh);
|
||||
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
struct RConnection;
|
||||
struct RSocketServ;
|
||||
void udp_rconn_set(struct RSocketServ *sockSrv, struct RConnection *rconn);
|
||||
#endif
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
* @file bld.inf Symbian build information
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
|
||||
PRJ_EXPORTS
|
||||
|
||||
..\..\include\re.h \epoc32\include\re\re.h
|
||||
..\..\include\re_base64.h \epoc32\include\re\re_base64.h
|
||||
..\..\include\re_bfcp.h \epoc32\include\re\re_bfcp.h
|
||||
..\..\include\re_bitv.h \epoc32\include\re\re_bitv.h
|
||||
..\..\include\re_conf.h \epoc32\include\re\re_conf.h
|
||||
..\..\include\re_crc32.h \epoc32\include\re\re_crc32.h
|
||||
..\..\include\re_dbg.h \epoc32\include\re\re_dbg.h
|
||||
..\..\include\re_dns.h \epoc32\include\re\re_dns.h
|
||||
..\..\include\re_fmt.h \epoc32\include\re\re_fmt.h
|
||||
..\..\include\re_hash.h \epoc32\include\re\re_hash.h
|
||||
..\..\include\re_hmac.h \epoc32\include\re\re_hmac.h
|
||||
..\..\include\re_httpauth.h \epoc32\include\re\re_httpauth.h
|
||||
..\..\include\re_ice.h \epoc32\include\re\re_ice.h
|
||||
..\..\include\re_jbuf.h \epoc32\include\re\re_jbuf.h
|
||||
..\..\include\re_list.h \epoc32\include\re\re_list.h
|
||||
..\..\include\re_lock.h \epoc32\include\re\re_lock.h
|
||||
..\..\include\re_main.h \epoc32\include\re\re_main.h
|
||||
..\..\include\re_mbuf.h \epoc32\include\re\re_mbuf.h
|
||||
..\..\include\re_md5.h \epoc32\include\re\re_md5.h
|
||||
..\..\include\re_mem.h \epoc32\include\re\re_mem.h
|
||||
..\..\include\re_mod.h \epoc32\include\re\re_mod.h
|
||||
..\..\include\re_mqueue.h \epoc32\include\re\re_mqueue.h
|
||||
..\..\include\re_natbd.h \epoc32\include\re\re_natbd.h
|
||||
..\..\include\re_net.h \epoc32\include\re\re_net.h
|
||||
..\..\include\re_rtp.h \epoc32\include\re\re_rtp.h
|
||||
..\..\include\re_sa.h \epoc32\include\re\re_sa.h
|
||||
..\..\include\re_sdp.h \epoc32\include\re\re_sdp.h
|
||||
..\..\include\re_sha.h \epoc32\include\re\re_sha.h
|
||||
..\..\include\re_sip.h \epoc32\include\re\re_sip.h
|
||||
..\..\include\re_sipevent.h \epoc32\include\re\re_sipevent.h
|
||||
..\..\include\re_sipreg.h \epoc32\include\re\re_sipreg.h
|
||||
..\..\include\re_sipsess.h \epoc32\include\re\re_sipsess.h
|
||||
..\..\include\re_stun.h \epoc32\include\re\re_stun.h
|
||||
..\..\include\re_sys.h \epoc32\include\re\re_sys.h
|
||||
..\..\include\re_tcp.h \epoc32\include\re\re_tcp.h
|
||||
..\..\include\re_telev.h \epoc32\include\re\re_telev.h
|
||||
..\..\include\re_tls.h \epoc32\include\re\re_tls.h
|
||||
..\..\include\re_tmr.h \epoc32\include\re\re_tmr.h
|
||||
..\..\include\re_turn.h \epoc32\include\re\re_turn.h
|
||||
..\..\include\re_types.h \epoc32\include\re\re_types.h
|
||||
..\..\include\re_udp.h \epoc32\include\re\re_udp.h
|
||||
..\..\include\re_uri.h \epoc32\include\re\re_uri.h
|
||||
|
||||
|
||||
PRJ_MMPFILES
|
||||
|
||||
re.mmp
|
||||
rebfcp.mmp
|
||||
redns.mmp
|
||||
resdp.mmp
|
||||
resip.mmp
|
||||
resipevent.mmp
|
||||
resipsess.mmp
|
||||
restun.mmp
|
|
@ -1,10 +0,0 @@
|
|||
#include <e32def.h>
|
||||
#include <e32std.h>
|
||||
|
||||
|
||||
#ifndef EKA2
|
||||
GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
|
||||
{
|
||||
return KErrNone;
|
||||
}
|
||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* @file ecrt.cpp ECRT wrapper for Symbian OS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <e32base.h>
|
||||
#include <e32cons.h>
|
||||
#include <sys/reent.h>
|
||||
|
||||
_LIT(KAppName, "retest");
|
||||
extern "C" int main(int argc, char** argv);
|
||||
|
||||
|
||||
TInt E32Main()
|
||||
{
|
||||
__UHEAP_MARK;
|
||||
CTrapCleanup* cleanup = CTrapCleanup::New();
|
||||
int ret = 0;
|
||||
TRAPD(err, ret = main(0, NULL));
|
||||
if (err)
|
||||
printf("main left with error %d\n", err);
|
||||
if (ret)
|
||||
printf("main returned %d\n", ret);
|
||||
__ASSERT_ALWAYS(!err, User::Panic(KAppName, err));
|
||||
CloseSTDLIB();
|
||||
delete cleanup;
|
||||
__UHEAP_MARKEND;
|
||||
return err;
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
/**
|
||||
* @file re.mmp Symbian makefile for libre
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET re.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x200112fa
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
MACRO HAVE_SYS_TIME_H
|
||||
MACRO HAVE_UNISTD_H
|
||||
MACRO HAVE_ACTSCHED
|
||||
|
||||
#ifndef EKA2
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
#endif
|
||||
|
||||
SOURCEPATH ..\..\src\base64
|
||||
SOURCE b64.c
|
||||
|
||||
SOURCEPATH ..\..\src\conf
|
||||
SOURCE conf.c
|
||||
|
||||
SOURCEPATH ..\..\src\crc32
|
||||
SOURCE crc32.c
|
||||
|
||||
SOURCEPATH ..\..\src\dbg
|
||||
SOURCE dbg.c
|
||||
|
||||
SOURCEPATH ..\..\src\fmt
|
||||
SOURCE ch.c
|
||||
SOURCE hexdump.c
|
||||
SOURCE pl.c
|
||||
SOURCE print.c
|
||||
SOURCE prm.c
|
||||
SOURCE regex.c
|
||||
SOURCE str.c
|
||||
SOURCE str_error.c
|
||||
SOURCE time.c
|
||||
|
||||
SOURCEPATH ..\..\src\hash
|
||||
SOURCE hash.c
|
||||
SOURCE func.c
|
||||
|
||||
SOURCEPATH ..\..\src\hmac
|
||||
SOURCE hmac_sha1.c
|
||||
|
||||
SOURCEPATH ..\..\src\httpauth
|
||||
SOURCE basic.c
|
||||
SOURCE digest.c
|
||||
|
||||
SOURCEPATH ..\..\src\jbuf
|
||||
SOURCE jbuf.c
|
||||
|
||||
SOURCEPATH ..\..\src\list
|
||||
SOURCE list.c
|
||||
|
||||
SOURCEPATH ..\..\src\lock
|
||||
SOURCE symbian\rmutex.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\main
|
||||
SOURCE init.c
|
||||
SOURCE main.c
|
||||
SOURCE method.c
|
||||
SOURCE symbian\actsched.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\mbuf
|
||||
SOURCE mbuf.c
|
||||
|
||||
SOURCEPATH ..\..\src\md5
|
||||
SOURCE md5.c
|
||||
SOURCE wrap.c
|
||||
|
||||
SOURCEPATH ..\..\src\mem
|
||||
SOURCE mem.c
|
||||
|
||||
SOURCEPATH ..\..\src\mod
|
||||
SOURCE mod.c
|
||||
SOURCE symbian\rlib.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\net
|
||||
SOURCE sock.c
|
||||
SOURCE netstr.c
|
||||
SOURCE if.c
|
||||
SOURCE rt.c
|
||||
SOURCE net.c
|
||||
SOURCE symbian\sif.cpp
|
||||
SOURCE symbian\snet.cpp
|
||||
SOURCE symbian\srt.cpp
|
||||
SOURCE symbian\rconn.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\rtp
|
||||
SOURCE fb.c
|
||||
SOURCE member.c
|
||||
SOURCE ntp.c
|
||||
SOURCE pkt.c
|
||||
SOURCE rr.c
|
||||
SOURCE rtcp.c
|
||||
SOURCE rtp.c
|
||||
SOURCE sdes.c
|
||||
SOURCE sess.c
|
||||
SOURCE source.c
|
||||
|
||||
SOURCEPATH ..\..\src\sa
|
||||
SOURCE ntop.c
|
||||
SOURCE printaddr.c
|
||||
SOURCE pton.c
|
||||
SOURCE sa.c
|
||||
|
||||
SOURCEPATH ..\..\src\sha
|
||||
SOURCE sha1.c
|
||||
|
||||
SOURCEPATH ..\..\src\sys
|
||||
SOURCE daemon.c
|
||||
SOURCE endian.c
|
||||
SOURCE fs.c
|
||||
SOURCE rand.c
|
||||
SOURCE sys.c
|
||||
SOURCE symbian\sleep.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\telev
|
||||
SOURCE telev.c
|
||||
|
||||
SOURCEPATH ..\..\src\tmr
|
||||
SOURCE tmr.c
|
||||
|
||||
SOURCEPATH ..\..\src\udp
|
||||
SOURCE symbian\udp.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\tcp
|
||||
SOURCE tcp_high.c
|
||||
SOURCE symbian\tcp.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\uri
|
||||
SOURCE ucmp.c
|
||||
SOURCE uri.c
|
||||
SOURCE uric.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* @file rebfcp.mmp Symbian makefile for libre BFCP
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET rebfcp.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x20011308
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
MACRO HAVE_SYS_TIME_H
|
||||
MACRO HAVE_UNISTD_H
|
||||
MACRO HAVE_ACTSCHED
|
||||
|
||||
#ifndef EKA2
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
#endif
|
||||
|
||||
SOURCEPATH ..\..\src\bfcp
|
||||
SOURCE attr.c
|
||||
SOURCE conn.c
|
||||
SOURCE msg.c
|
||||
SOURCE reply.c
|
||||
SOURCE request.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,38 +0,0 @@
|
|||
/**
|
||||
* @file redns.mmp Symbian makefile for libre DNS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET redns.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x20011309
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\dns
|
||||
SOURCE client.c
|
||||
SOURCE cstr.c
|
||||
SOURCE dname.c
|
||||
SOURCE hdr.c
|
||||
SOURCE ns.c
|
||||
SOURCE rr.c
|
||||
SOURCE rrlist.c
|
||||
SOURCE symbian\srv.cpp
|
||||
|
||||
USERINCLUDE .
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* @file resdp.mmp Symbian makefile for libre SDP
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET resdp.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x2001130C
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\sdp
|
||||
SOURCE attr.c
|
||||
SOURCE format.c
|
||||
SOURCE media.c
|
||||
SOURCE msg.c
|
||||
SOURCE session.c
|
||||
SOURCE str.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,52 +0,0 @@
|
|||
/**
|
||||
* @file resip.mmp Symbian makefile for libre SIP
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET resip.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x2001130A
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\httpauth
|
||||
SOURCE basic.c
|
||||
SOURCE digest.c
|
||||
|
||||
SOURCEPATH ..\..\src\sip
|
||||
SOURCE addr.c
|
||||
SOURCE auth.c
|
||||
SOURCE cseq.c
|
||||
SOURCE ctrans.c
|
||||
SOURCE dialog.c
|
||||
SOURCE keepalive.c
|
||||
SOURCE keepalive_udp.c
|
||||
SOURCE msg.c
|
||||
SOURCE param.c
|
||||
SOURCE reply.c
|
||||
SOURCE request.c
|
||||
SOURCE sip.c
|
||||
SOURCE strans.c
|
||||
SOURCE transp.c
|
||||
SOURCE via.c
|
||||
|
||||
SOURCEPATH ..\..\src\sipreg
|
||||
SOURCE reg.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* @file resipevent.mmp Symbian makefile for libre SIP Event
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET resipevent.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x20011307
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\sipevent
|
||||
SOURCE listen.c
|
||||
SOURCE msg.c
|
||||
SOURCE notify.c
|
||||
SOURCE subscribe.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* @file resipsess.mmp Symbian makefile for libre SIP Session
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET resipsess.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x2001130D
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\sipsess
|
||||
SOURCE accept.c
|
||||
SOURCE ack.c
|
||||
SOURCE close.c
|
||||
SOURCE connect.c
|
||||
SOURCE info.c
|
||||
SOURCE listen.c
|
||||
SOURCE modify.c
|
||||
SOURCE reply.c
|
||||
SOURCE request.c
|
||||
SOURCE sess.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,71 +0,0 @@
|
|||
/**
|
||||
* @file restun.mmp Symbian makefile for libre STUN
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
TARGET restun.lib
|
||||
TARGETTYPE lib
|
||||
TARGETPATH system\libs
|
||||
UID 0x10000fd3 0x2001130B
|
||||
|
||||
#ifdef EKA2
|
||||
VENDORID 0
|
||||
CAPABILITY NetworkServices
|
||||
#endif
|
||||
|
||||
MACRO HAVE_SYS_TIME_H
|
||||
MACRO HAVE_UNISTD_H
|
||||
|
||||
SOURCEPATH .
|
||||
SOURCE dll.cpp
|
||||
|
||||
SOURCEPATH ..\..\src\ice
|
||||
SOURCE cand.c
|
||||
SOURCE candpair.c
|
||||
SOURCE chklist.c
|
||||
SOURCE comp.c
|
||||
SOURCE connchk.c
|
||||
SOURCE gather.c
|
||||
SOURCE ice.c
|
||||
SOURCE icem.c
|
||||
SOURCE icesdp.c
|
||||
SOURCE icestr.c
|
||||
SOURCE stunsrv.c
|
||||
SOURCE util.c
|
||||
|
||||
SOURCEPATH ..\..\src\natbd
|
||||
SOURCE filtering.c
|
||||
SOURCE genalg.c
|
||||
SOURCE hairpinning.c
|
||||
SOURCE lifetime.c
|
||||
SOURCE mapping.c
|
||||
SOURCE natstr.c
|
||||
|
||||
SOURCEPATH ..\..\src\stun
|
||||
SOURCE addr.c
|
||||
SOURCE attr.c
|
||||
SOURCE ctrans.c
|
||||
SOURCE dnsdisc.c
|
||||
SOURCE hdr.c
|
||||
SOURCE ind.c
|
||||
SOURCE keepalive.c
|
||||
SOURCE msg.c
|
||||
SOURCE rep.c
|
||||
SOURCE req.c
|
||||
SOURCE stun.c
|
||||
|
||||
SOURCEPATH ..\..\src\turn
|
||||
SOURCE chan.c
|
||||
SOURCE perm.c
|
||||
SOURCE turnc.c
|
||||
|
||||
USERINCLUDE . ..\..\include
|
||||
SYSTEMINCLUDE \epoc32\include
|
||||
SYSTEMINCLUDE \epoc32\include\libc
|
||||
SYSTEMINCLUDE ..\..\include
|
||||
#ifndef EKA2
|
||||
LIBRARY estlib.lib euser.lib
|
||||
LIBRARY esock.lib insock.lib
|
||||
#endif
|
||||
|
||||
EXPORTUNFROZEN
|
|
@ -1,189 +0,0 @@
|
|||
/**
|
||||
* @file rconn.cpp Networking connections for Symbian OS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <e32std.h>
|
||||
#include <commdbconnpref.h>
|
||||
#include <es_sock.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <re_types.h>
|
||||
#include <re_sa.h>
|
||||
#include <re_net.h>
|
||||
#include <re_udp.h>
|
||||
#include <re_tcp.h>
|
||||
|
||||
#define DEBUG_MODULE "rconn"
|
||||
#define DEBUG_LEVEL 5
|
||||
#include <re_dbg.h>
|
||||
}
|
||||
|
||||
|
||||
class CRconn : public CActive
|
||||
{
|
||||
public:
|
||||
static CRconn *NewL(net_conn_h *ch);
|
||||
~CRconn();
|
||||
|
||||
TInt Start(TUint32 aIapId, TBool aPrompt);
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
CRconn(net_conn_h *ch);
|
||||
void ConstructL();
|
||||
|
||||
/* from CActive */
|
||||
virtual void RunL();
|
||||
virtual void DoCancel();
|
||||
|
||||
private:
|
||||
RSocketServ iServ;
|
||||
RConnection iConn;
|
||||
net_conn_h *ch;
|
||||
};
|
||||
|
||||
|
||||
static CRconn *rconn = NULL;
|
||||
|
||||
|
||||
CRconn *CRconn::NewL(net_conn_h *ch)
|
||||
{
|
||||
CRconn *c = new (ELeave) CRconn(ch);
|
||||
CleanupStack::PushL(c);
|
||||
c->ConstructL();
|
||||
CleanupStack::Pop(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
CRconn::~CRconn()
|
||||
{
|
||||
DEBUG_INFO("~CRconn\n");
|
||||
udp_rconn_set(NULL, NULL);
|
||||
tcp_rconn_set(NULL, NULL);
|
||||
Stop();
|
||||
|
||||
iConn.Close();
|
||||
iServ.Close();
|
||||
}
|
||||
|
||||
|
||||
CRconn::CRconn(net_conn_h *ch)
|
||||
:CActive(EPriorityStandard)
|
||||
,ch(ch)
|
||||
{
|
||||
CActiveScheduler::Add(this);
|
||||
}
|
||||
|
||||
|
||||
void CRconn::ConstructL()
|
||||
{
|
||||
TInt err;
|
||||
|
||||
User::LeaveIfError(iServ.Connect());
|
||||
|
||||
err = iConn.Open(iServ);
|
||||
if (KErrNone != err) {
|
||||
DEBUG_WARNING("iConn.Open err=%d\n", err);
|
||||
User::Leave(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CRconn::RunL()
|
||||
{
|
||||
TUint count;
|
||||
TInt ret;
|
||||
|
||||
DEBUG_INFO("CRconn::RunL err=%d\n", iStatus.Int());
|
||||
|
||||
if (KErrNone == iStatus.Int()) {
|
||||
udp_rconn_set(&iServ, &iConn);
|
||||
tcp_rconn_set(&iServ, &iConn);
|
||||
}
|
||||
|
||||
/* Get the IAP id of the underlying interface of this RConnection */
|
||||
TUint32 iapId = 0;
|
||||
ret = iConn.GetIntSetting(_L("IAP\\Id"), iapId);
|
||||
if (KErrNone == ret) {
|
||||
DEBUG_INFO("RConn: Using IAP=%u\n", iapId);
|
||||
}
|
||||
|
||||
ret = iConn.EnumerateConnections(count);
|
||||
if (KErrNone != ret) {
|
||||
DEBUG_WARNING("EnumerateConnections: ret=%d\n", ret);
|
||||
}
|
||||
else {
|
||||
DEBUG_INFO("Enumerated connections: %u\n", count);
|
||||
}
|
||||
|
||||
ch(kerr2errno(iStatus.Int()), iapId);
|
||||
}
|
||||
|
||||
|
||||
void CRconn::DoCancel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Connect to the network using this IAP ID
|
||||
*/
|
||||
TInt CRconn::Start(TUint32 aIapId, TBool aPrompt)
|
||||
{
|
||||
DEBUG_INFO("CRconn::Start: IAP id %u\n", aIapId);
|
||||
|
||||
Cancel();
|
||||
|
||||
TCommDbConnPref prefs;
|
||||
prefs.SetIapId(aIapId);
|
||||
if (aPrompt)
|
||||
prefs.SetDialogPreference(ECommDbDialogPrefPrompt);
|
||||
else
|
||||
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
|
||||
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
|
||||
|
||||
iConn.Start(prefs, iStatus);
|
||||
SetActive();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CRconn::Stop()
|
||||
{
|
||||
DEBUG_INFO("CRconn::Stop\n");
|
||||
|
||||
Cancel();
|
||||
const TInt err = iConn.Stop();
|
||||
if (err) {
|
||||
DEBUG_INFO("CRconn::Stop err=%d\n", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int net_conn_start(net_conn_h *ch, uint32_t id, bool prompt)
|
||||
{
|
||||
DEBUG_NOTICE("rconn_start: iap_id=%u prompt=%d\n", id, prompt);
|
||||
|
||||
if (rconn)
|
||||
return 0;
|
||||
|
||||
TRAPD(ret, rconn = CRconn::NewL(ch));
|
||||
if (KErrNone != ret)
|
||||
return kerr2errno(ret);
|
||||
|
||||
return kerr2errno(rconn->Start(id, prompt));
|
||||
}
|
||||
|
||||
|
||||
void net_conn_stop(void)
|
||||
{
|
||||
if (!rconn)
|
||||
return;
|
||||
|
||||
delete rconn;
|
||||
rconn = NULL;
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
/**
|
||||
* @file sif.cpp Network interface code for Symbian OS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <es_sock.h>
|
||||
#include <in_sock.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <re_types.h>
|
||||
#include <re_fmt.h>
|
||||
#include <re_mbuf.h>
|
||||
#include <re_sa.h>
|
||||
#include <re_net.h>
|
||||
|
||||
#define DEBUG_MODULE "sif"
|
||||
#define DEBUG_LEVEL 5
|
||||
#include <re_dbg.h>
|
||||
}
|
||||
|
||||
|
||||
static void des2buf(char *buf, size_t sz, TDesC &des)
|
||||
{
|
||||
TBuf8<256> buf8;
|
||||
buf8.Copy(des);
|
||||
|
||||
strncpy(buf, (char *)buf8.PtrZ(), sz);
|
||||
}
|
||||
|
||||
|
||||
int net_if_debug(struct re_printf *pf, void *unused)
|
||||
{
|
||||
RSocketServ serv;
|
||||
RSocket sock;
|
||||
int ret, err = 0;
|
||||
|
||||
(void)unused;
|
||||
|
||||
err |= re_hprintf(pf, "net interfaces:\n");
|
||||
|
||||
ret = serv.Connect();
|
||||
if (KErrNone != ret)
|
||||
return kerr2errno(ret);
|
||||
ret = sock.Open(serv, KAfInet, KSockStream, KProtocolInetTcp);
|
||||
if (KErrNone != ret) {
|
||||
serv.Close();
|
||||
return kerr2errno(ret);
|
||||
}
|
||||
sock.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
|
||||
|
||||
TPckgBuf<TSoInetInterfaceInfo> ifinfo;
|
||||
|
||||
while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl,
|
||||
ifinfo)==KErrNone) {
|
||||
struct sa sa;
|
||||
char buf[128];
|
||||
const char *state = NULL;
|
||||
|
||||
des2buf(buf, sizeof(buf), ifinfo().iName);
|
||||
err |= re_hprintf(pf, "Interface Name: %s\n", buf);
|
||||
|
||||
switch (ifinfo().iState) {
|
||||
|
||||
case EIfPending: state = "Pending"; break;
|
||||
case EIfUp: state = "Up"; break;
|
||||
case EIfBusy: state = "Busy"; break;
|
||||
case EIfDown: state = "Down"; break;
|
||||
}
|
||||
err |= re_hprintf(pf, " State: %s\n", state);
|
||||
|
||||
err |= re_hprintf(pf, " Speed Metric: %d\n",
|
||||
ifinfo().iSpeedMetric);
|
||||
|
||||
TBuf<32> mac;
|
||||
mac.Zero();
|
||||
for (TUint i = sizeof(SSockAddr);
|
||||
i<sizeof(SSockAddr)+6;
|
||||
i++) {
|
||||
if (i < (TUint)ifinfo().iHwAddr.Length()) {
|
||||
mac.AppendFormat(_L("%02X%c"),
|
||||
ifinfo().iHwAddr[i],
|
||||
i<(sizeof(SSockAddr)+5)
|
||||
?':':' ');
|
||||
}
|
||||
}
|
||||
|
||||
des2buf(buf, sizeof(buf), mac);
|
||||
err |= re_hprintf(pf, " Mac Address: %s\n", buf);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iAddress.Address(), 0);
|
||||
err |= re_hprintf(pf, " IP Address: %j\n", &sa);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iNetMask.Address(), 0);
|
||||
err |= re_hprintf(pf, " Netmask: %j\n", &sa);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iBrdAddr.Address(), 0);
|
||||
err |= re_hprintf(pf, " Broadcast: %s\n", &sa);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iDefGate.Address(), 0);
|
||||
err |= re_hprintf(pf, " Gateway: %s\n", &sa);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iNameSer1.Address(), 0);
|
||||
err |= re_hprintf(pf, " DNS IP 1: %s\n", &sa);
|
||||
|
||||
sa_set_in(&sa, ifinfo().iNameSer2.Address(), 0);
|
||||
err |= re_hprintf(pf, " DNS IP 2: %s\n", &sa);
|
||||
}
|
||||
|
||||
sock.Close();
|
||||
serv.Close();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int net_if_list(net_ifaddr_h *ifh, void *arg)
|
||||
{
|
||||
RSocketServ serv;
|
||||
RSocket sock;
|
||||
int ret;
|
||||
|
||||
if (!ifh)
|
||||
return EINVAL;
|
||||
|
||||
ret = serv.Connect();
|
||||
if (KErrNone != ret)
|
||||
return kerr2errno(ret);
|
||||
ret = sock.Open(serv, KAfInet, KSockStream, KProtocolInetTcp);
|
||||
if (KErrNone != ret) {
|
||||
serv.Close();
|
||||
return kerr2errno(ret);
|
||||
}
|
||||
sock.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
|
||||
|
||||
TPckgBuf<TSoInetInterfaceInfo> ifinfo;
|
||||
while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl,
|
||||
ifinfo)==KErrNone) {
|
||||
struct sa sa;
|
||||
char ifname[128];
|
||||
|
||||
if (EIfUp != ifinfo().iState)
|
||||
continue;
|
||||
|
||||
des2buf(ifname, sizeof(ifname), ifinfo().iName);
|
||||
sa_set_in(&sa, ifinfo().iAddress.Address(), 0);
|
||||
|
||||
if (ifh(ifname, &sa, arg))
|
||||
break;
|
||||
}
|
||||
|
||||
sock.Close();
|
||||
serv.Close();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/**
|
||||
* @file snet.cpp Networking code for Symbian OS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <es_sock.h>
|
||||
#include <in_sock.h>
|
||||
#include <string.h>
|
||||
#include <re_types.h>
|
||||
#include <re_fmt.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <re_mbuf.h>
|
||||
#include <re_sa.h>
|
||||
#include <re_net.h>
|
||||
|
||||
#define DEBUG_MODULE "snet"
|
||||
#define DEBUG_LEVEL 5
|
||||
#include <re_dbg.h>
|
||||
}
|
||||
|
||||
|
||||
static struct sa local_ip;
|
||||
|
||||
|
||||
/**
|
||||
* Convert from Symbian error code to POSIX error code
|
||||
*
|
||||
* @param kerr Symbian error code
|
||||
*
|
||||
* @return POSIX error code
|
||||
*/
|
||||
int kerr2errno(int kerr)
|
||||
{
|
||||
switch (kerr) {
|
||||
|
||||
case KErrNone: return 0;
|
||||
case KErrNotFound: return ENOENT;
|
||||
case KErrGeneral: return EINVAL;
|
||||
case KErrNoMemory: return ENOMEM;
|
||||
case KErrNotSupported: return ENOSYS;
|
||||
case KErrArgument: return EINVAL;
|
||||
case KErrAlreadyExists: return EALREADY;
|
||||
case KErrTimedOut: return ETIMEDOUT;
|
||||
case KErrNetUnreach: return ENONET;
|
||||
case KErrHostUnreach: return ECONNREFUSED;
|
||||
default: return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the local IP address of the device
|
||||
*
|
||||
* @note Requires at least one IP packet sent in advance!
|
||||
*/
|
||||
int net_if_getaddr4(const char *ifname, int af, struct sa *ip)
|
||||
{
|
||||
(void)ifname;
|
||||
|
||||
if (AF_INET != af)
|
||||
return EAFNOSUPPORT;
|
||||
|
||||
/* Already cached? */
|
||||
if (sa_isset(&local_ip, SA_ADDR)) {
|
||||
sa_cpy(ip, &local_ip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RSocketServ ss;
|
||||
RSocket s;
|
||||
TInt ret;
|
||||
|
||||
ret = ss.Connect();
|
||||
if (KErrNone != ret) {
|
||||
DEBUG_WARNING("connecting to socket server fail (ret=%d)\n",
|
||||
ret);
|
||||
return ECONNREFUSED;
|
||||
}
|
||||
|
||||
ret = s.Open(ss, KAfInet, KSockDatagram, KProtocolInetUdp);
|
||||
if (KErrNone != ret) {
|
||||
DEBUG_WARNING("open socket failed (ret=%d)\n", ret);
|
||||
return ECONNREFUSED;
|
||||
}
|
||||
|
||||
TInetAddr bind;
|
||||
bind.SetPort(0);
|
||||
bind.SetAddress(KInetAddrAny);
|
||||
|
||||
ret = s.Bind(bind);
|
||||
if (KErrNone != ret) {
|
||||
DEBUG_WARNING("bind socket failed (ret=%d)\n", ret);
|
||||
return ECONNREFUSED;
|
||||
}
|
||||
|
||||
TInetAddr local;
|
||||
s.LocalName(local);
|
||||
|
||||
s.Close();
|
||||
ss.Close();
|
||||
|
||||
sa_set_in(&local_ip, local.Address(), local.Port());
|
||||
|
||||
DEBUG_NOTICE("local IP addr: %j\n", &local_ip);
|
||||
|
||||
if (!sa_isset(&local_ip, SA_ADDR))
|
||||
return EINVAL;
|
||||
|
||||
sa_cpy(ip, &local_ip);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/**
|
||||
* @file srt.cpp Routing table code for Symbian OS
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <es_sock.h>
|
||||
#include <in_sock.h>
|
||||
#include <string.h>
|
||||
#include <re_types.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <re_sa.h>
|
||||
#include <re_net.h>
|
||||
#include <re_mbuf.h>
|
||||
|
||||
#define DEBUG_MODULE "netrt"
|
||||
#define DEBUG_LEVEL 5
|
||||
#include <re_dbg.h>
|
||||
}
|
||||
|
||||
|
||||
int net_rt_list(net_rt_h *rth, void *arg)
|
||||
{
|
||||
if (!rth)
|
||||
return EINVAL;
|
||||
|
||||
RSocketServ serv;
|
||||
RSocket sock;
|
||||
if (KErrNone != serv.Connect())
|
||||
return ECONNREFUSED;
|
||||
if (KErrNone != sock.Open(serv, KAfInet, KSockStream,
|
||||
KProtocolInetTcp))
|
||||
return ECONNREFUSED;
|
||||
sock.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl);
|
||||
|
||||
TPckgBuf<TSoInetRouteInfo> rtinfo;
|
||||
while (sock.GetOpt(KSoInetNextRoute, KSolInetRtCtrl,
|
||||
rtinfo)==KErrNone) {
|
||||
char ifname[16];
|
||||
struct sa dst, gw, sa, if_ip;
|
||||
int dstlen;
|
||||
int af = AF_INET;
|
||||
|
||||
sa_set_in(&if_ip, rtinfo().iIfAddr.Address(), 0);
|
||||
|
||||
#ifdef HAVE_INET6
|
||||
if (KAfInet6 == rtinfo().iIfAddr.Family())
|
||||
af = AF_INET6;
|
||||
#endif
|
||||
if (net_if_getname(ifname, sizeof(ifname), af, &if_ip)) {
|
||||
DEBUG_WARNING(" could not get ifname for IP=%j\n",
|
||||
&if_ip);
|
||||
}
|
||||
|
||||
sa_set_in(&gw, rtinfo().iGateway.Address(), 0);
|
||||
sa_set_in(&dst, rtinfo().iDstAddr.Address(), 0);
|
||||
sa_set_in(&sa, rtinfo().iNetMask.Address(), 0);
|
||||
|
||||
dstlen = 0; // TODO
|
||||
|
||||
if (rth(ifname, &dst, dstlen, &gw, arg))
|
||||
break;
|
||||
}
|
||||
|
||||
sock.Close();
|
||||
serv.Close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int net_rt_default_get(int af, char *ifname, size_t size)
|
||||
{
|
||||
(void)af;
|
||||
(void)ifname;
|
||||
(void)size;
|
||||
return ENOSYS;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,571 +0,0 @@
|
|||
/**
|
||||
* @file udp.cpp User Datagram Protocol for Symbian
|
||||
*
|
||||
* Copyright (C) 2010 Creytiv.com
|
||||
*/
|
||||
#include <es_sock.h>
|
||||
#include <in_sock.h>
|
||||
|
||||
extern "C" {
|
||||
#include <re_types.h>
|
||||
#include <re_mem.h>
|
||||
#include <re_mbuf.h>
|
||||
#include <re_list.h>
|
||||
#include <re_sa.h>
|
||||
#include <re_net.h>
|
||||
#include <re_udp.h>
|
||||
|
||||
|
||||
#define DEBUG_MODULE "udp"
|
||||
#define DEBUG_LEVEL 5
|
||||
#include <re_dbg.h>
|
||||
}
|
||||
|
||||
|
||||
enum {
|
||||
UDP_RXSZ_DEFAULT = 8192
|
||||
};
|
||||
|
||||
|
||||
class CUdpSocket : public CActive {
|
||||
public:
|
||||
CUdpSocket(struct udp_sock *us);
|
||||
~CUdpSocket();
|
||||
int Open();
|
||||
void StartReceiving();
|
||||
|
||||
protected:
|
||||
void RunL();
|
||||
void DoCancel();
|
||||
|
||||
public:
|
||||
RSocketServ iSocketServer; /**< Socket Server */
|
||||
RSocket iSocket; /**< Socket object */
|
||||
TBuf8<UDP_RXSZ_DEFAULT> iBufRx; /**< Receive buffer */
|
||||
TInetAddr iSource; /**< Source IP address */
|
||||
struct udp_sock *us; /**< Parent UDP socket */
|
||||
};
|
||||
|
||||
|
||||
struct udp_sock {
|
||||
public:
|
||||
int listen(const struct sa *local);
|
||||
int send(const struct sa *dst, struct mbuf *mb);
|
||||
void recv();
|
||||
int local_get(struct sa *local) const;
|
||||
|
||||
public:
|
||||
struct list helpers;
|
||||
CUdpSocket *cus; /**< UDP Socket object */
|
||||
udp_recv_h *rh; /**< Receive handler */
|
||||
void *arg; /**< Handler argument */
|
||||
bool conn; /**< Connected socket flag */
|
||||
size_t rxsz; /**< Maximum receive chunk size */
|
||||
size_t rx_presz; /**< Preallocated rx buffer size */
|
||||
int cerr; /**< Cached error code */
|
||||
};
|
||||
|
||||
|
||||
struct udp_helper {
|
||||
struct le le;
|
||||
int layer;
|
||||
udp_helper_send_h *sendh;
|
||||
udp_helper_recv_h *recvh;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
|
||||
static RSocketServ *socketServer = NULL;
|
||||
static RConnection *rconnection = NULL;
|
||||
|
||||
|
||||
CUdpSocket::CUdpSocket(struct udp_sock *us)
|
||||
:CActive(EPriorityHigh)
|
||||
,us(us)
|
||||
{
|
||||
CActiveScheduler::Add(this);
|
||||
}
|
||||
|
||||
|
||||
CUdpSocket::~CUdpSocket()
|
||||
{
|
||||
Cancel();
|
||||
iSocket.Close();
|
||||
|
||||
/* Only close the socket server if we own it */
|
||||
if (!socketServer)
|
||||
iSocketServer.Close();
|
||||
}
|
||||
|
||||
|
||||
int CUdpSocket::Open()
|
||||
{
|
||||
TInt err;
|
||||
|
||||
if (socketServer) {
|
||||
DEBUG_INFO("UDPsock(%p): Using RSocketServ=%p (handle=%d)\n",
|
||||
us, socketServer, socketServer->Handle());
|
||||
|
||||
iSocketServer = *socketServer;
|
||||
}
|
||||
else {
|
||||
err = iSocketServer.Connect();
|
||||
if (KErrNone != err) {
|
||||
DEBUG_WARNING("iSocketServer.Connect failed\n");
|
||||
return kerr2errno(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (rconnection) {
|
||||
DEBUG_INFO("UDPsock: Using RConnection=%p\n", rconnection);
|
||||
err = iSocket.Open(iSocketServer, KAfInet, KSockDatagram,
|
||||
KProtocolInetUdp, *rconnection);
|
||||
}
|
||||
else {
|
||||
err = iSocket.Open(iSocketServer, KAfInet, KSockDatagram,
|
||||
KProtocolInetUdp);
|
||||
}
|
||||
if (KErrNone != err) {
|
||||
DEBUG_WARNING("iSocket.Open failed (err=%d)\n", err);
|
||||
return kerr2errno(err);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CUdpSocket::StartReceiving()
|
||||
{
|
||||
/* Clear buffer */
|
||||
iBufRx.Zero();
|
||||
|
||||
if (!IsActive())
|
||||
SetActive();
|
||||
|
||||
iSocket.RecvFrom(iBufRx, iSource, 0, iStatus);
|
||||
}
|
||||
|
||||
|
||||
void CUdpSocket::RunL()
|
||||
{
|
||||
DEBUG_INFO("RunL iStatus=%d\n", iStatus.Int());
|
||||
|
||||
/* This happens after calling cancel functions in socket */
|
||||
if (iStatus == KErrCancel || iStatus == KErrAbort) {
|
||||
iStatus = KErrNone;
|
||||
}
|
||||
else if (iStatus == KErrGeneral) {
|
||||
/* cache error code */
|
||||
us->cerr = ECONNREFUSED;
|
||||
}
|
||||
else if (iStatus != KErrNone) {
|
||||
DEBUG_WARNING("RunL received iStatus %d\n", iStatus.Int());
|
||||
}
|
||||
else if (iBufRx.Length()) {
|
||||
us->recv();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CUdpSocket::DoCancel()
|
||||
{
|
||||
iSocket.CancelAll();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
int udp_sock::listen(const struct sa *local)
|
||||
{
|
||||
TInetAddr ia(sa_in(local), sa_port(local));
|
||||
|
||||
const TInt ret = cus->iSocket.Bind(ia);
|
||||
if (KErrNone != ret)
|
||||
return kerr2errno(ret);
|
||||
|
||||
cus->StartReceiving();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int udp_sock::send(const struct sa *dst, struct mbuf *mb)
|
||||
{
|
||||
struct sa hdst;
|
||||
TRequestStatus stat;
|
||||
int err = 0;
|
||||
|
||||
DEBUG_INFO("udp_sock::send %u bytes to %J\n", mbuf_get_left(mb), dst);
|
||||
|
||||
/* Check for error in e.g. connected state */
|
||||
if (cerr) {
|
||||
err = cerr;
|
||||
cerr = 0; /* clear error */
|
||||
return err;
|
||||
}
|
||||
|
||||
/* call helpers in reverse order */
|
||||
struct le *le = list_tail(&helpers);
|
||||
while (le) {
|
||||
struct udp_helper *uh;
|
||||
|
||||
uh = (struct udp_helper *)le->data;
|
||||
le = le->prev;
|
||||
|
||||
if (dst != &hdst) {
|
||||
sa_cpy(&hdst, dst);
|
||||
dst = &hdst;
|
||||
}
|
||||
|
||||
if (uh->sendh(&err, &hdst, mb, uh->arg) || err)
|
||||
return err;
|
||||
}
|
||||
|
||||
TInetAddr ia(sa_in(dst), sa_port(dst));
|
||||
|
||||
const TPtrC8 buf_tx(mb->buf + mb->pos, mb->end - mb->pos);
|
||||
|
||||
if (conn) {
|
||||
cus->iSocket.Connect(ia, stat);
|
||||
User::WaitForRequest(stat);
|
||||
|
||||
if (KErrNone != stat.Int()) {
|
||||
DEBUG_WARNING("udp_sock::send Connect: kerr=%d\n",
|
||||
stat.Int());
|
||||
if (KErrGeneral == stat.Int())
|
||||
return ECONNREFUSED;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* TODO: Cause Access-Violation in WINS emulator! */
|
||||
cus->iSocket.Send(buf_tx, 0, stat);
|
||||
#else
|
||||
cus->iSocket.SendTo(buf_tx, ia, 0, stat);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
cus->iSocket.SendTo(buf_tx, ia, 0, stat);
|
||||
}
|
||||
|
||||
User::WaitForRequest(stat);
|
||||
|
||||
return kerr2errno(stat.Int());
|
||||
}
|
||||
|
||||
|
||||
void udp_sock::recv()
|
||||
{
|
||||
struct mbuf *mb = mbuf_alloc(rx_presz + cus->iBufRx.Length());
|
||||
if (!mb)
|
||||
return;
|
||||
|
||||
mb->pos += rx_presz;
|
||||
mb->end += rx_presz;
|
||||
|
||||
(void)mbuf_write_mem(mb, (uint8_t *)cus->iBufRx.Ptr(),
|
||||
cus->iBufRx.Length());
|
||||
mb->pos = rx_presz;
|
||||
|
||||
struct sa src;
|
||||
sa_set_in(&src, cus->iSource.Address(), cus->iSource.Port());
|
||||
|
||||
/* call helpers */
|
||||
struct le *le = list_head(&helpers);
|
||||
while (le) {
|
||||
struct udp_helper *uh;
|
||||
bool hdld;
|
||||
|
||||
uh = (struct udp_helper *)le->data;
|
||||
le = le->next;
|
||||
|
||||
hdld = uh->recvh(&src, mb, uh->arg);
|
||||
|
||||
if (hdld)
|
||||
goto out;
|
||||
}
|
||||
|
||||
DEBUG_INFO("udp recv %d bytes from %J\n", cus->iBufRx.Length(), &src);
|
||||
|
||||
cus->StartReceiving();
|
||||
|
||||
rh(&src, mb, arg);
|
||||
|
||||
out:
|
||||
mem_deref(mb);
|
||||
}
|
||||
|
||||
|
||||
int udp_sock::local_get(struct sa *local) const
|
||||
{
|
||||
TInetAddr ia;
|
||||
|
||||
cus->iSocket.LocalName(ia);
|
||||
sa_set_in(local, ia.Address(), ia.Port());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
static void udp_destructor(void *data)
|
||||
{
|
||||
struct udp_sock *us = (struct udp_sock *)data;
|
||||
|
||||
list_flush(&us->helpers);
|
||||
|
||||
delete us->cus;
|
||||
}
|
||||
|
||||
|
||||
static void dummy_udp_recv_handler(const struct sa *src,
|
||||
struct mbuf *mb, void *arg)
|
||||
{
|
||||
(void)src;
|
||||
(void)mb;
|
||||
(void)arg;
|
||||
}
|
||||
|
||||
|
||||
int udp_listen(struct udp_sock **usp, const struct sa *local,
|
||||
udp_recv_h *rh, void *arg)
|
||||
{
|
||||
struct udp_sock *us = (struct udp_sock *)NULL;
|
||||
int err;
|
||||
|
||||
if (!usp)
|
||||
return EINVAL;
|
||||
|
||||
us = (struct udp_sock *)mem_zalloc(sizeof(*us), udp_destructor);
|
||||
if (!us)
|
||||
return ENOMEM;
|
||||
|
||||
us->cus = new CUdpSocket(us);
|
||||
if (!us->cus) {
|
||||
err = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = us->cus->Open();
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
us->rh = rh ? rh : dummy_udp_recv_handler;
|
||||
us->arg = arg;
|
||||
|
||||
err = us->listen(local);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
*usp = us;
|
||||
|
||||
out:
|
||||
if (err)
|
||||
mem_deref(us);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void udp_connect(struct udp_sock *us, bool conn)
|
||||
{
|
||||
if (!us)
|
||||
return;
|
||||
|
||||
us->conn = conn;
|
||||
}
|
||||
|
||||
|
||||
int udp_send(struct udp_sock *us, const struct sa *dst, struct mbuf *mb)
|
||||
{
|
||||
if (!us || !dst || !mb)
|
||||
return EINVAL;
|
||||
|
||||
DEBUG_INFO("udp_send: US %u bytes to %J\n", mb->end, dst);
|
||||
|
||||
return us->send(dst, mb);
|
||||
}
|
||||
|
||||
|
||||
int udp_local_get(const struct udp_sock *us, struct sa *local)
|
||||
{
|
||||
if (!us || !local)
|
||||
return EINVAL;
|
||||
|
||||
return us->local_get(local);
|
||||
}
|
||||
|
||||
|
||||
int udp_setsockopt(struct udp_sock *us, int level, int optname,
|
||||
const void *optval, uint32_t optlen)
|
||||
{
|
||||
(void)us;
|
||||
(void)level;
|
||||
(void)optname;
|
||||
(void)optval;
|
||||
(void)optlen;
|
||||
|
||||
return ENOSYS; /* not mapped to Symbian sockets */
|
||||
|
||||
#if 0
|
||||
/* TODO: use this. see:
|
||||
http://www.forum.nokia.com/document/Forum_Nokia_Technical_
|
||||
Library/contents/FNTL/Increasing_WLAN_power_efficiency_for
|
||||
_full-duplex_VoIP_and_Video_applications.htm
|
||||
*/
|
||||
iSocket.SetOpt( KSoIpTOS, KProtocolInetIp, 0xe0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int udp_sockbuf_set(struct udp_sock *us, int size)
|
||||
{
|
||||
(void)us;
|
||||
(void)size;
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
void udp_rxsz_set(struct udp_sock *us, size_t rxsz)
|
||||
{
|
||||
if (!us)
|
||||
return;
|
||||
|
||||
us->rxsz = rxsz;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set preallocated space on receive buffer.
|
||||
*
|
||||
* @param us UDP Socket
|
||||
* @param rx_presz Size of preallocate space.
|
||||
*/
|
||||
void udp_rxbuf_presz_set(struct udp_sock *us, size_t rx_presz)
|
||||
{
|
||||
if (!us)
|
||||
return;
|
||||
|
||||
us->rx_presz = rx_presz;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set receive handler on a UDP Socket
|
||||
*
|
||||
* @param us UDP Socket
|
||||
* @param rh Receive handler
|
||||
* @param arg Handler argument
|
||||
*/
|
||||
void udp_handler_set(struct udp_sock *us, udp_recv_h *rh, void *arg)
|
||||
{
|
||||
if (!us)
|
||||
return;
|
||||
|
||||
us->rh = rh ? rh : dummy_udp_recv_handler;
|
||||
us->arg = arg;
|
||||
}
|
||||
|
||||
|
||||
int udp_sock_fd(const struct udp_sock *us, int af)
|
||||
{
|
||||
(void)us;
|
||||
(void)af;
|
||||
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
void udp_rconn_set(RSocketServ *sockSrv, RConnection *rconn)
|
||||
{
|
||||
socketServer = sockSrv;
|
||||
rconnection = rconn;
|
||||
}
|
||||
|
||||
|
||||
int udp_send_anon(const struct sa *dst, struct mbuf *mb)
|
||||
{
|
||||
struct udp_sock *us;
|
||||
int err;
|
||||
|
||||
if (!dst || !mb)
|
||||
return EINVAL;
|
||||
|
||||
err = udp_listen(&us, NULL, NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = udp_send(us, dst, mb);
|
||||
mem_deref(us);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static void helper_destructor(void *data)
|
||||
{
|
||||
struct udp_helper *uh = (struct udp_helper *)data;
|
||||
|
||||
list_unlink(&uh->le);
|
||||
}
|
||||
|
||||
|
||||
static bool helper_send_handler(int *err, struct sa *dst,
|
||||
struct mbuf *mb, void *arg)
|
||||
{
|
||||
(void)err;
|
||||
(void)dst;
|
||||
(void)mb;
|
||||
(void)arg;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool helper_recv_handler(struct sa *src, struct mbuf *mb, void *arg)
|
||||
{
|
||||
(void)src;
|
||||
(void)mb;
|
||||
(void)arg;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool sort_handler(struct le *le1, struct le *le2, void *arg)
|
||||
{
|
||||
struct udp_helper *uh1 = (struct udp_helper *)le1->data;
|
||||
struct udp_helper *uh2 = (struct udp_helper *)le2->data;
|
||||
(void)arg;
|
||||
|
||||
return uh1->layer <= uh2->layer;
|
||||
}
|
||||
|
||||
|
||||
int udp_register_helper(struct udp_helper **uhp, struct udp_sock *us,
|
||||
int layer,
|
||||
udp_helper_send_h *sh, udp_helper_recv_h *rh,
|
||||
void *arg)
|
||||
{
|
||||
struct udp_helper *uh;
|
||||
|
||||
if (!us)
|
||||
return EINVAL;
|
||||
|
||||
uh = (struct udp_helper *)mem_zalloc(sizeof(*uh), helper_destructor);
|
||||
if (!uh)
|
||||
return ENOMEM;
|
||||
|
||||
list_append(&us->helpers, &uh->le, uh);
|
||||
|
||||
uh->layer = layer;
|
||||
uh->sendh = sh ? sh : helper_send_handler;
|
||||
uh->recvh = rh ? rh : helper_recv_handler;
|
||||
uh->arg = arg;
|
||||
|
||||
list_sort(&us->helpers, sort_handler, NULL);
|
||||
|
||||
if (uhp)
|
||||
*uhp = uh;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue