From 043aa32cc22b7e2996d8b27ac2367b3d5602bee7 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 18 Sep 2016 17:00:57 +0200 Subject: [PATCH 1/2] remove support for Symbian OS --- docs/README | 2 +- include/re_net.h | 6 - include/re_tcp.h | 7 - include/re_udp.h | 7 - mk/symbian/bld.inf | 62 --- mk/symbian/dll.cpp | 10 - mk/symbian/ecrt.cpp | 31 -- mk/symbian/re.mmp | 155 ------ mk/symbian/rebfcp.mmp | 41 -- mk/symbian/redns.mmp | 38 -- mk/symbian/resdp.mmp | 36 -- mk/symbian/resip.mmp | 52 -- mk/symbian/resipevent.mmp | 34 -- mk/symbian/resipsess.mmp | 40 -- mk/symbian/restun.mmp | 71 --- src/net/symbian/rconn.cpp | 189 ------- src/net/symbian/sif.cpp | 157 ------ src/net/symbian/snet.cpp | 114 ----- src/net/symbian/srt.cpp | 79 --- src/tcp/symbian/tcp.cpp | 1006 ------------------------------------- src/udp/symbian/udp.cpp | 571 --------------------- 21 files changed, 1 insertion(+), 2707 deletions(-) delete mode 100644 mk/symbian/bld.inf delete mode 100644 mk/symbian/dll.cpp delete mode 100644 mk/symbian/ecrt.cpp delete mode 100644 mk/symbian/re.mmp delete mode 100644 mk/symbian/rebfcp.mmp delete mode 100644 mk/symbian/redns.mmp delete mode 100644 mk/symbian/resdp.mmp delete mode 100644 mk/symbian/resip.mmp delete mode 100644 mk/symbian/resipevent.mmp delete mode 100644 mk/symbian/resipsess.mmp delete mode 100644 mk/symbian/restun.mmp delete mode 100644 src/net/symbian/rconn.cpp delete mode 100644 src/net/symbian/sif.cpp delete mode 100644 src/net/symbian/snet.cpp delete mode 100644 src/net/symbian/srt.cpp delete mode 100644 src/tcp/symbian/tcp.cpp delete mode 100644 src/udp/symbian/udp.cpp diff --git a/docs/README b/docs/README index d31b4ac..66fc597 100644 --- a/docs/README +++ b/docs/README @@ -130,7 +130,7 @@ Supported platforms: * FreeBSD * OpenBSD * NetBSD -* Symbian OS +* Symbian OS (not supported) * Solaris * Windows * Apple Mac OS X and iOS diff --git a/include/re_net.h b/include/re_net.h index 81f511a..4e7c7ac 100644 --- a/include/re_net.h +++ b/include/re_net.h @@ -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 diff --git a/include/re_tcp.h b/include/re_tcp.h index 33749d0..98dba71 100644 --- a/include/re_tcp.h +++ b/include/re_tcp.h @@ -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); diff --git a/include/re_udp.h b/include/re_udp.h index e9cdcd1..1c091de 100644 --- a/include/re_udp.h +++ b/include/re_udp.h @@ -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 diff --git a/mk/symbian/bld.inf b/mk/symbian/bld.inf deleted file mode 100644 index 9a428f9..0000000 --- a/mk/symbian/bld.inf +++ /dev/null @@ -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 diff --git a/mk/symbian/dll.cpp b/mk/symbian/dll.cpp deleted file mode 100644 index ebd7f68..0000000 --- a/mk/symbian/dll.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - - -#ifndef EKA2 -GLDEF_C TInt E32Dll(TDllReason /*aReason*/) -{ - return KErrNone; -} -#endif diff --git a/mk/symbian/ecrt.cpp b/mk/symbian/ecrt.cpp deleted file mode 100644 index 61e9e69..0000000 --- a/mk/symbian/ecrt.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file ecrt.cpp ECRT wrapper for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include -#include -#include - -_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; -} diff --git a/mk/symbian/re.mmp b/mk/symbian/re.mmp deleted file mode 100644 index 6ff41fd..0000000 --- a/mk/symbian/re.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/rebfcp.mmp b/mk/symbian/rebfcp.mmp deleted file mode 100644 index f485cea..0000000 --- a/mk/symbian/rebfcp.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/redns.mmp b/mk/symbian/redns.mmp deleted file mode 100644 index a744afb..0000000 --- a/mk/symbian/redns.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/resdp.mmp b/mk/symbian/resdp.mmp deleted file mode 100644 index 514cd6c..0000000 --- a/mk/symbian/resdp.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/resip.mmp b/mk/symbian/resip.mmp deleted file mode 100644 index 3251c63..0000000 --- a/mk/symbian/resip.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/resipevent.mmp b/mk/symbian/resipevent.mmp deleted file mode 100644 index c0eb19b..0000000 --- a/mk/symbian/resipevent.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/resipsess.mmp b/mk/symbian/resipsess.mmp deleted file mode 100644 index 07d6cae..0000000 --- a/mk/symbian/resipsess.mmp +++ /dev/null @@ -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 diff --git a/mk/symbian/restun.mmp b/mk/symbian/restun.mmp deleted file mode 100644 index c2524de..0000000 --- a/mk/symbian/restun.mmp +++ /dev/null @@ -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 diff --git a/src/net/symbian/rconn.cpp b/src/net/symbian/rconn.cpp deleted file mode 100644 index 83026d2..0000000 --- a/src/net/symbian/rconn.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/** - * @file rconn.cpp Networking connections for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include - - -extern "C" { -#include -#include -#include -#include -#include - -#define DEBUG_MODULE "rconn" -#define DEBUG_LEVEL 5 -#include -} - - -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; -} diff --git a/src/net/symbian/sif.cpp b/src/net/symbian/sif.cpp deleted file mode 100644 index 298c675..0000000 --- a/src/net/symbian/sif.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @file sif.cpp Network interface code for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include - - -extern "C" { -#include -#include -#include -#include -#include - -#define DEBUG_MODULE "sif" -#define DEBUG_LEVEL 5 -#include -} - - -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 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 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; -} diff --git a/src/net/symbian/snet.cpp b/src/net/symbian/snet.cpp deleted file mode 100644 index 9309ce7..0000000 --- a/src/net/symbian/snet.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @file snet.cpp Networking code for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include -#include -#include - - -extern "C" { -#include -#include -#include - -#define DEBUG_MODULE "snet" -#define DEBUG_LEVEL 5 -#include -} - - -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; -} diff --git a/src/net/symbian/srt.cpp b/src/net/symbian/srt.cpp deleted file mode 100644 index dd88f02..0000000 --- a/src/net/symbian/srt.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file srt.cpp Routing table code for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include -#include - - -extern "C" { -#include -#include -#include - -#define DEBUG_MODULE "netrt" -#define DEBUG_LEVEL 5 -#include -} - - -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 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; -} diff --git a/src/tcp/symbian/tcp.cpp b/src/tcp/symbian/tcp.cpp deleted file mode 100644 index 225ef94..0000000 --- a/src/tcp/symbian/tcp.cpp +++ /dev/null @@ -1,1006 +0,0 @@ -/** - * @file tcp.cpp Transport Control Protocol for Symbian - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include - -extern "C" { -#include -#include -#include -#include -#include -#include -#include - - -#define DEBUG_MODULE "tcp" -#define DEBUG_LEVEL 5 -#include -} - - -enum { - TCP_RXSZ_DEFAULT = 8192 -}; - - -/** - * Singleton proxy to RSocketServer with reference counting - */ -class CTcpSocketServer : public CBase { -public: - CTcpSocketServer(); - ~CTcpSocketServer(); - -public: - static RSocketServ iSocketServer; /**< Socket Server */ -private: - static TInt iRefCount; -}; - - -class CTcpSock : public CActive { -public: - CTcpSock(struct tcp_sock *ts); - ~CTcpSock(); - int Bind(TInetAddr &ia); - int Listen(int backlog); - void Accepting(); -protected: - void RunL(); - void DoCancel(); -public: - CTcpSocketServer* iSockServer; /**< Shared Socket Server */ - RSocket iSocket; /**< Socket object */ - struct tcp_sock *ts; -}; - - -class CTcpConn : public CActive { -public: - CTcpConn(struct tcp_sock *ts); - CTcpConn(struct tcp_conn *tc); - ~CTcpConn(); - int Open(TInetAddr &ia); - int Bind(TInetAddr &ia); - int Connect(TInetAddr &ia); - void StartReceiving(); -protected: - void RunL(); - void DoCancel(); -public: - CTcpSocketServer* iSockServer; /**< Shared Socket Server */ - RSocket iSocket; /**< Socket object */ - TBuf8 iBufRx; /**< Receive buffer */ - TSockXfrLength iLen; - bool connecting; - bool receiving; - bool blank; - struct tcp_sock *ts; - struct tcp_conn *tc; -}; - - -/** Defines a listening TCP socket */ -struct tcp_sock { -public: - int blank_socket(); - void tcp_conn_handler(); -public: - CTcpSock *cts; /**< Listening TCP socket */ - CTcpConn *ctc; /**< Pending blank socket (connection) */ - tcp_conn_h *connh; /**< TCP Connect handler */ - void *arg; /**< Handler argument */ -}; - - -/** Defines a TCP connection */ -struct tcp_conn { -public: - void recv(); - void conn_close(int err); - int send(struct mbuf *mb); -public: - struct list helpers; - CTcpConn *ctc; /**< TCP Connection socket */ - tcp_estab_h *estabh; /**< Connection established handler */ - tcp_recv_h *recvh; /**< Data receive handler */ - tcp_close_h *closeh; /**< Connection close handler */ - void *arg; /**< Handler argument */ - size_t rxsz; /**< Maximum receive chunk size */ - bool active; -}; - -struct tcp_helper { - struct le le; - int layer; - tcp_helper_estab_h *estabh; - tcp_helper_send_h *sendh; - tcp_helper_recv_h *recvh; - void *arg; -}; - -static RSocketServ *socketServer = NULL; -static RConnection *rconnection = NULL; - - -/**************************************************************************** - * Implementation of CTcpSocketServer * - ****************************************************************************/ - -RSocketServ CTcpSocketServer::iSocketServer; -TInt CTcpSocketServer::iRefCount = 0; - - -CTcpSocketServer::CTcpSocketServer() -{ - DEBUG_INFO("CTcpSocketServer(%p) ctor refcount=%d\n", this, - iRefCount); - - if (iRefCount == 0) { - DEBUG_INFO("CTcpSocketServer(%p) ctor Connect\n", this); - - if (socketServer) { - iSocketServer = *socketServer; - } - else { - iSocketServer.Connect(); - } - } - - ++iRefCount; -} - - -CTcpSocketServer::~CTcpSocketServer() -{ - DEBUG_INFO("CTcpSocketServer(%p) dtor: refcount=%d\n", this, - iRefCount); - - if (--iRefCount == 0) { - DEBUG_INFO("CTcpSocketServer(%p) dtor Close\n", this); - - if (!socketServer) - iSocketServer.Close(); - } -} - - -/**************************************************************************** - * Implementation of CTcpSock * - ****************************************************************************/ - - -CTcpSock::CTcpSock(struct tcp_sock *ts) - :CActive(EPriorityHigh) - ,ts(ts) -{ - DEBUG_INFO("CTcpSock(%p) ctor\n", this); - CActiveScheduler::Add(this); - iSockServer = new CTcpSocketServer(); -} - - -CTcpSock::~CTcpSock() -{ - DEBUG_INFO("~CTcpSock(%p) dtor\n", this); - - Cancel(); - - iSocket.Close(); - delete iSockServer; -} - - -int CTcpSock::Bind(TInetAddr &ia) -{ - TInt ret; - - ret = iSocket.Open(ts->cts->iSockServer->iSocketServer, ia.Family(), - KSockStream, KProtocolInetTcp); - if (KErrNone != ret) { - DEBUG_WARNING("bind: Open (ret=%d)\n", ret); - goto error; - } - - ret = iSocket.SetOpt(KSoReuseAddr, KSolInetIp, 1); - if (KErrNone != ret) { - DEBUG_WARNING("SetOpt ReuseAddr: ret=%d\n", ret); - } - - ret = iSocket.Bind(ia); - if (KErrNone != ret) { - DEBUG_WARNING("bind: Bind (ret=%d)\n", ret); - goto error; - } - - error: - return kerr2errno(ret); -} - - -int CTcpSock::Listen(int backlog) -{ - return kerr2errno(iSocket.Listen(backlog)); -} - - -void CTcpSock::Accepting() -{ - /* MUST be done before RemoteName() */ - iSocket.Accept(ts->ctc->iSocket, iStatus); - SetActive(); -} - - -void CTcpSock::RunL() -{ - DEBUG_INFO("CTcpSock RunL (%p) iStatus=%d ts=%p\n", this, - iStatus.Int(), ts); - - /* This happens after calling cancel functions in socket */ - if (iStatus == KErrCancel || iStatus == KErrAbort) { - iStatus = KErrNone; - return; - } - else if (iStatus != KErrNone) { - DEBUG_WARNING("RunL received iStatus %d\n", iStatus.Int()); - } - - /* Incoming CONNECT */ - DEBUG_INFO("CTcpSock RunL (%p) Incoming CONNECT\n", this); - ts->tcp_conn_handler(); -} - - -void CTcpSock::DoCancel() -{ - DEBUG_INFO("CTcpSock(%p) DoCancel\n", this); - - iSocket.CancelAll(); -} - - -/**************************************************************************** - * Implementation of CTcpConn * - ****************************************************************************/ - - -CTcpConn::CTcpConn(struct tcp_conn *tc) - :CActive(EPriorityHigh) - ,ts(NULL) - ,tc(tc) -{ - DEBUG_INFO("CTcpConn(%p) ctor (tc=%p)\n", this, tc); - - CActiveScheduler::Add(this); - iSockServer = new CTcpSocketServer(); -} - - -CTcpConn::CTcpConn(struct tcp_sock *ts) - :CActive(EPriorityHigh) - ,ts(ts) - ,tc(NULL) -{ - DEBUG_INFO("CTcpConn(%p) ctor (ts=%p)\n", this, ts); - CActiveScheduler::Add(this); - iSockServer = new CTcpSocketServer(); -} - - -CTcpConn::~CTcpConn() -{ - DEBUG_INFO("~CTcpConn(%p) dtor\n", this); - - Cancel(); - - /* - * This does not work for accepted connections, if the main - * socketserver is closed in CTcpSock in advance - */ - if (!blank) { - iSocket.Close(); - } - - delete iSockServer; -} - - -int CTcpConn::Open(TInetAddr &ia) -{ - TInt ret; - if (rconnection) { - DEBUG_INFO("TCP Socket Open: Using RConnection=%p\n", - rconnection); - ret = iSocket.Open(iSockServer->iSocketServer, ia.Family(), - KSockStream, KProtocolInetTcp, - *rconnection); - } - else { - ret = iSocket.Open(iSockServer->iSocketServer, ia.Family(), - KSockStream, KProtocolInetTcp); - } - - return kerr2errno(ret); -} - - -int CTcpConn::Bind(TInetAddr &ia) -{ - TInt ret; - - ret = iSocket.SetOpt(KSoReuseAddr, KSolInetIp, 1); - if (KErrNone != ret) { - DEBUG_WARNING("SetOpt ReuseAddr: ret=%d\n", ret); - } - - return kerr2errno(iSocket.Bind(ia)); -} - - -int CTcpConn::Connect(TInetAddr &ia) -{ - DEBUG_INFO("CTcpConn(%p) Connect\n", this); - - connecting = true; - - iSocket.Connect(ia, iStatus); - SetActive(); - - return 0; -} - - -void CTcpConn::StartReceiving() -{ - DEBUG_INFO("TcpConn(%p) StartReceiving\n", this); - - /* Clear buffer */ - iBufRx.Zero(); - - receiving = true; - - iSocket.RecvOneOrMore(iBufRx, 0, iStatus, iLen); - SetActive(); -} - - -void CTcpConn::RunL() -{ - DEBUG_INFO("CTcpConn RunL (%p) iStatus=%d ts=%p tc=%p\n", this, - iStatus.Int(), ts, tc); - - /* This happens after calling cancel functions in socket */ - if (iStatus == KErrCancel || iStatus == KErrAbort) { - iStatus = KErrNone; - return; - } - else if (iStatus == KErrEof) { - ; - } - else if (iStatus != KErrNone) { - DEBUG_WARNING("RunL received iStatus %d\n", iStatus.Int()); - } - - /* Outgoing CONNECT */ - if (connecting) { - connecting = false; - if (iStatus == KErrNone) { - int err = 0; - DEBUG_INFO("TCP Conn ESTABLISHED\n"); - - struct le *le = list_head(&tc->helpers); - while (le) { - struct tcp_helper *th; - - th = (struct tcp_helper *)le->data; - le = le->next; - - if (th->estabh(&err, tc->active, th->arg) - || err) { - if (err) - tc->conn_close(err); - return; - } - } - - if (tc->estabh) - tc->estabh(tc->arg); - StartReceiving(); - } - else { - DEBUG_WARNING("RunL: connecting (%d)\n", - iStatus.Int()); - tc->conn_close(ECONNREFUSED); - } - } - /* Incoming DATA */ - else if (receiving) { - if (iStatus == KErrEof) - tc->conn_close(0); - else - tc->recv(); - } - else { - DEBUG_WARNING("CTcpConn RunL: bogus state\n"); - } -} - - -void CTcpConn::DoCancel() -{ - DEBUG_INFO("CTcpConn(%p) DoCancel\n", this); - - iSocket.CancelAll(); -} - - -/**************************************************************************** - * Implementation of struct tcp_sock * - ****************************************************************************/ - - -/** - * Create new blank socket (pending incoming connection) - */ -int tcp_sock::blank_socket() -{ - int ret; - - DEBUG_INFO("Creating new blank socket\n"); - - if (ctc) { - DEBUG_WARNING("blank socket: already created\n"); - return EALREADY; - } - - ctc = new CTcpConn(this); - if (!ctc) - return ENOMEM; - - ctc->blank = true; - - /* Create a blank socket */ - ret = ctc->iSocket.Open(cts->iSockServer->iSocketServer); - if (KErrNone != ret) { - DEBUG_WARNING("create blank socket failed (ret=%d)\n", ret); - goto error; - } - - return 0; - - error: - delete ctc; - ctc = NULL; - - return kerr2errno(ret); -} - - -/** - * Handle incoming connects - */ -void tcp_sock::tcp_conn_handler() -{ - if (!ctc) { - DEBUG_WARNING("conn handler: no pending socket\n"); - } - - TInetAddr ia; - struct sa peer; - ctc->iSocket.RemoteName(ia); - sa_set_in(&peer, ia.Address(), ia.Port()); - - DEBUG_INFO("conn handler: incoming connect from %J\n", &peer); - - ctc->blank = false; - - /* - * Application handler might call tcp_accept(), tcp_reject() - * or do nothing - */ - if (connh) - connh(&peer, arg); - - if (ctc) { - DEBUG_INFO("delete ctc\n"); - delete ctc; - ctc = NULL; - } - - /* Create blank socket for the next incoming CONNECT */ - blank_socket(); - - cts->Accepting(); -} - - -/**************************************************************************** - * Implementation of struct tcp_conn * - ****************************************************************************/ - - -int tcp_conn::send(struct mbuf *mb) -{ - if (!ctc) { - DEBUG_WARNING("send: internal error - no ctc\n"); - return EINVAL; - } - - DEBUG_INFO("TCP Send %u bytes\n", mbuf_get_left(mb)); - - /* call helpers in reverse order */ - int err = 0; - struct le *le = list_tail(&helpers); - while (le) { - struct tcp_helper *th; - - th = (struct tcp_helper *)le->data; - le = le->prev; - - if (th->sendh(&err, mb, th->arg) || err) - return err; - } - - const TPtrC8 buf_tx(mb->buf + mb->pos, mb->end - mb->pos); - - TRequestStatus stat; - ctc->iSocket.Send(buf_tx, 0, stat); - User::WaitForRequest(stat); /* TODO blocking */ - - return kerr2errno(stat.Int()); -} - - -void tcp_conn::recv() -{ - struct mbuf *mb; - struct le *le; - bool hlp_estab = false; - int err = 0; - - DEBUG_INFO("TCP Receive %u bytes\n", ctc->iBufRx.Length()); - - /* If no memory packet will be dropped */ - mb = mbuf_alloc(ctc->iBufRx.Length()); - if (mb) { - (void)mbuf_write_mem(mb, (uint8_t *)ctc->iBufRx.Ptr(), - ctc->iBufRx.Length()); - mb->pos = 0; - } - - ctc->StartReceiving(); - - if (!mb) - goto out; - - le = list_head(&helpers); - while (le) { - struct tcp_helper *th; - bool hdld; - - th = (struct tcp_helper *)le->data; - le = le->next; - - if (!hlp_estab) - hdld = th->recvh(&err, mb, &hlp_estab, arg); - else - hdld = th->estabh(&err, active, arg); - - if (hdld || err) { - if (err) - conn_close(err); - goto out; - } - } - - mbuf_trim(mb); - - if (!hlp_estab) { - if (recvh) - recvh(mb, arg); - } - else { - if (estabh) - estabh(arg); - } - - out: - mem_deref(mb); -} - - -void tcp_conn::conn_close(int err) -{ - DEBUG_INFO("tcp conn close (%m)\n", err); - - /* Stop receiving */ - if (ctc->receiving) { - ctc->iSocket.CancelRead(); - ctc->receiving = false; - } - - if (closeh) - closeh(err, arg); -} - - -/**************************************************************************** - * Exported functions * - ****************************************************************************/ - - -static void sock_destructor(void *data) -{ - struct tcp_sock *ts = (struct tcp_sock *)data; - - if (ts->ctc) - delete ts->ctc; - if (ts->cts) - delete ts->cts; -} - - -static void conn_destructor(void *data) -{ - struct tcp_conn *tc = (struct tcp_conn *)data; - - list_flush(&tc->helpers); - - if (tc->ctc) - delete tc->ctc; -} - - -static struct tcp_conn *conn_alloc(CTcpConn *ctc, - tcp_estab_h *eh, tcp_recv_h *rh, - tcp_close_h *ch, void *arg) -{ - struct tcp_conn *tc; - - tc = (struct tcp_conn *)mem_zalloc(sizeof(*tc), conn_destructor); - if (!tc) - return NULL; - - list_init(&tc->helpers); - - if (ctc) { - DEBUG_INFO("conn_new: using ctc\n"); - tc->ctc = ctc; - } - else { - tc->ctc = new CTcpConn(tc); - if (!tc->ctc) { - DEBUG_WARNING("conn_new: new CTcpConn failed\n"); - goto error; - } - } - - tc->rxsz = TCP_RXSZ_DEFAULT; - tc->estabh = eh; - tc->recvh = rh; - tc->closeh = ch; - tc->arg = arg; - - return tc; - - error: - return (struct tcp_conn *)mem_deref(tc); -} - - -int tcp_sock_alloc(struct tcp_sock **tsp, const struct sa *local, - tcp_conn_h *ch, void *arg) -{ - struct tcp_sock *ts; - int err = 0; - - /* Local address is unused on Symbian */ - (void)local; - - if (!tsp) - return EINVAL; - - ts = (struct tcp_sock *)mem_zalloc(sizeof(*ts), sock_destructor); - if (!ts) - return ENOMEM; - - ts->cts = new CTcpSock(ts); - if (!ts->cts) { - err = ENOMEM; - goto out; - } - - ts->connh = ch; - ts->arg = arg; - - *tsp = ts; - - out: - if (err) - mem_deref(ts); - - return err; -} - - -int tcp_sock_bind(struct tcp_sock *ts, const struct sa *local) -{ - if (!ts || !ts->cts || !local) - return EINVAL; - - TInetAddr ia(sa_in(local), sa_port(local)); - - return ts->cts->Bind(ia); -} - - -int tcp_sock_listen(struct tcp_sock *ts, int backlog) -{ - int err; - - if (!ts || !ts->cts) - return EINVAL; - - err = ts->cts->Listen(backlog); - if (err) - goto out; - - err = ts->blank_socket(); - if (err) - goto out; - - ts->cts->Accepting(); - - out: - return err; -} - - -int tcp_accept(struct tcp_conn **tcp, struct tcp_sock *ts, tcp_estab_h *eh, - tcp_recv_h *rh, tcp_close_h *ch, void *arg) -{ - struct tcp_conn *tc; - - if (!tcp || !ts) - return EINVAL; - - DEBUG_INFO("tcp_accept() ts=%p\n", ts); - - tc = conn_alloc(ts->ctc, eh, rh, ch, arg); - if (!tc) - return ENOMEM; - - /* Transfer ownership to TCP connection */ - ts->ctc->tc = tc; - ts->ctc = NULL; - - tc->ctc->StartReceiving(); - - *tcp = tc; - - return 0; -} - - -void tcp_reject(struct tcp_sock *ts) -{ - if (!ts) - return; - - delete ts->ctc; - ts->ctc = NULL; -} - - -int tcp_conn_alloc(struct tcp_conn **tcp, const struct sa *peer, - tcp_estab_h *eh, tcp_recv_h *rh, tcp_close_h *ch, - void *arg) -{ - struct tcp_conn *tc; - int err; - - if (!tcp || !sa_isset(peer, SA_ALL)) - return EINVAL; - - tc = conn_alloc(NULL, eh, rh, ch, arg); - if (!tc) - return ENOMEM; - - TInetAddr ia(sa_in(peer), sa_port(peer)); - - err = tc->ctc->Open(ia); - if (err) - goto out; - - *tcp = tc; - - out: - if (err) { - DEBUG_WARNING("conn_alloc: %J (%m)\n", peer, err); - mem_deref(tc); - } - return err; -} - - -int tcp_conn_bind(struct tcp_conn *tc, const struct sa *local) -{ - if (!tc || !tc->ctc || !local) - return EINVAL; - - TInetAddr ia(sa_in(local), sa_port(local)); - - return tc->ctc->Bind(ia); -} - - -int tcp_conn_connect(struct tcp_conn *tc, const struct sa *peer) -{ - if (!tc || !tc->ctc || !sa_isset(peer, SA_ALL)) - return EINVAL; - - tc->active = true; - - TInetAddr ia(sa_in(peer), sa_port(peer)); - - return tc->ctc->Connect(ia); -} - - -int tcp_send(struct tcp_conn *tc, struct mbuf *mb) -{ - if (!tc || !mb) - return EINVAL; - - return tc->send(mb); -} - - -int tcp_sock_local_get(const struct tcp_sock *ts, struct sa *local) -{ - if (!ts || !local) - return EINVAL; - - TInetAddr ia; - ts->cts->iSocket.LocalName(ia); - sa_set_in(local, ia.Address(), ia.Port()); - - return 0; -} - - -void tcp_conn_rxsz_set(struct tcp_conn *tc, size_t rxsz) -{ - if (!tc) - return; - - tc->rxsz = rxsz; -} - - -int tcp_conn_local_get(const struct tcp_conn *tc, struct sa *local) -{ - if (!tc || !local) - return EINVAL; - - TInetAddr ia; - tc->ctc->iSocket.LocalName(ia); - sa_set_in(local, ia.Address(), ia.Port()); - - return 0; -} - - -int tcp_conn_peer_get(const struct tcp_conn *tc, struct sa *peer) -{ - if (!tc || !peer) - return EINVAL; - - TInetAddr ia; - tc->ctc->iSocket.RemoteName(ia); - sa_set_in(peer, ia.Address(), ia.Port()); - - return 0; -} - - -void tcp_rconn_set(RSocketServ *sockSrv, RConnection *rconn) -{ - socketServer = sockSrv; - rconnection = rconn; -} - - -int tcp_conn_fd(const struct tcp_conn *tc) -{ - (void)tc; - return -1; -} - - -/**************************************************************************** - * TCP Helpers * - ****************************************************************************/ - - -static void helper_destructor(void *data) -{ - struct tcp_helper *th = (struct tcp_helper *)data; - - list_unlink(&th->le); -} - - -static bool helper_estab_handler(int *err, bool active, void *arg) -{ - (void)err; - (void)active; - (void)arg; - return false; -} - - -static bool helper_send_handler(int *err, struct mbuf *mb, void *arg) -{ - (void)err; - (void)mb; - (void)arg; - return false; -} - - -static bool helper_recv_handler(int *err, struct mbuf *mb, bool *estab, - void *arg) -{ - (void)err; - (void)mb; - (void)estab; - (void)arg; - return false; -} - - -static bool sort_handler(struct le *le1, struct le *le2, void *arg) -{ - struct tcp_helper *th1 = (struct tcp_helper *)le1->data; - struct tcp_helper *th2 = (struct tcp_helper *)le2->data; - (void)arg; - - return th1->layer <= th2->layer; -} - - -int tcp_register_helper(struct tcp_helper **thp, struct tcp_conn *tc, - int layer, - tcp_helper_estab_h *eh, tcp_helper_send_h *sh, - tcp_helper_recv_h *rh, void *arg) -{ - struct tcp_helper *th; - - if (!tc) - return EINVAL; - - th = (struct tcp_helper *)mem_zalloc(sizeof(*th), helper_destructor); - if (!th) - return ENOMEM; - - list_append(&tc->helpers, &th->le, th); - - th->layer = layer; - th->estabh = eh ? eh : helper_estab_handler; - th->sendh = sh ? sh : helper_send_handler; - th->recvh = rh ? rh : helper_recv_handler; - th->arg = arg; - - list_sort(&tc->helpers, sort_handler, NULL); - - if (thp) - *thp = th; - - return 0; -} diff --git a/src/udp/symbian/udp.cpp b/src/udp/symbian/udp.cpp deleted file mode 100644 index bd448e5..0000000 --- a/src/udp/symbian/udp.cpp +++ /dev/null @@ -1,571 +0,0 @@ -/** - * @file udp.cpp User Datagram Protocol for Symbian - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include - -extern "C" { -#include -#include -#include -#include -#include -#include -#include - - -#define DEBUG_MODULE "udp" -#define DEBUG_LEVEL 5 -#include -} - - -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 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; -} From 495f5ff51bd4a37b36aacb72e6c9ca9648dff483 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 18 Sep 2016 17:11:37 +0200 Subject: [PATCH 2/2] remove symbian --- src/dns/ns.c | 9 -- src/dns/symbian/srv.cpp | 85 ----------------- src/lock/symbian/rmutex.cpp | 87 ----------------- src/main/main.c | 2 - src/main/symbian/actsched.cpp | 169 ---------------------------------- src/mod/symbian/rlib.cpp | 67 -------------- src/net/if.c | 2 - src/net/sockopt.c | 2 - src/sys/fs.c | 8 -- src/sys/symbian/sleep.cpp | 18 ---- src/sys/sys.c | 4 +- src/tcp/tcp.c | 4 - src/udp/udp.c | 4 - 13 files changed, 1 insertion(+), 460 deletions(-) delete mode 100644 src/dns/symbian/srv.cpp delete mode 100644 src/lock/symbian/rmutex.cpp delete mode 100644 src/main/symbian/actsched.cpp delete mode 100644 src/mod/symbian/rlib.cpp delete mode 100644 src/sys/symbian/sleep.cpp diff --git a/src/dns/ns.c b/src/dns/ns.c index c2e1b01..1284e6c 100644 --- a/src/dns/ns.c +++ b/src/dns/ns.c @@ -21,11 +21,6 @@ #include -#ifdef __SYMBIAN32__ -extern int get_symbiandns(struct sa *nsv, uint32_t *n); -#endif - - static int parse_resolv_conf(char *domain, size_t dsize, struct sa *srvv, uint32_t *n) { @@ -147,10 +142,6 @@ int dns_srv_get(char *domain, size_t dsize, struct sa *srvv, uint32_t *n) err = get_windns(domain, dsize, srvv, n); #endif -#ifdef __SYMBIAN32__ - err = get_symbiandns(srvv, n); -#endif - #ifdef __ANDROID__ err = get_android_dns(srvv, n); #endif diff --git a/src/dns/symbian/srv.cpp b/src/dns/symbian/srv.cpp deleted file mode 100644 index 5283828..0000000 --- a/src/dns/symbian/srv.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @file srv.cpp Get DNS Server IP code for Symbian OS - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include - - -extern "C" { -#include -#include -#include -#include -#include -#include -extern int get_symbiandns(struct sa *nsv, uint32_t *n); -} - - -int get_symbiandns(struct sa *nsv, uint32_t *n) -{ - RSocketServ serv; - RSocket sock; - uint32_t i = 0; - int ret; - - if (!nsv || !n || !*n) - 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 ifinfo; - while (sock.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, - ifinfo)==KErrNone) { - struct sa sa; - - if (EIfUp != ifinfo().iState) - continue; - - sa_set_in(&sa, ifinfo().iAddress.Address(), 0); - - if (sa_is_loopback(&sa)) - continue; - - if (sa_is_linklocal(&sa)) - continue; - - if (ifinfo().iNameSer1.Address()) { - sa_set_in(&nsv[i], ifinfo().iNameSer1.Address(), - DNS_PORT); - ++i; - } - - if (i >= *n) - break; - - if (ifinfo().iNameSer2.Address()) { - sa_set_in(&nsv[i], ifinfo().iNameSer2.Address(), - DNS_PORT); - ++i; - } - - if (i >= *n) - break; - } - - sock.Close(); - serv.Close(); - - if (i == 0) - return ENOENT; - - *n = i; - - return 0; -} diff --git a/src/lock/symbian/rmutex.cpp b/src/lock/symbian/rmutex.cpp deleted file mode 100644 index 1f7f595..0000000 --- a/src/lock/symbian/rmutex.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file rmutex.cpp Symbian RMutex locking - * - * Copyright (C) 2010 Creytiv.com - */ -#include - -extern "C" { -#include -#include -#include -} - - -struct lock { - RMutex m; -}; - - -static void lock_destructor(void *data) -{ - struct lock *l = (struct lock *)data; - - l->m.Close(); -} - - -int lock_alloc(struct lock **lp) -{ - struct lock *l; - - if (!lp) - return EINVAL; - - l = (struct lock *)mem_zalloc(sizeof(*l), lock_destructor); - if (!l) - return ENOMEM; - - const TInt ret = l->m.CreateLocal(); - if (KErrNone != ret) { - return EINVAL; - } - - *lp = l; - return 0; -} - - -void lock_read_get(struct lock *l) -{ - if (!l) - return; - - l->m.Wait(); -} - - -void lock_write_get(struct lock *l) -{ - if (!l) - return; - - l->m.Wait(); -} - - -int lock_read_try(struct lock *l) -{ - (void)l; - return ENOSYS; -} - - -int lock_write_try(struct lock *l) -{ - (void)l; - return ENOSYS; -} - - -void lock_rel(struct lock *l) -{ - if (!l) - return; - - l->m.Signal(); -} diff --git a/src/main/main.c b/src/main/main.c index 81fbffb..fd6e0ea 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -14,8 +14,6 @@ #endif #ifdef WIN32 #include -#elif defined(__SYMBIAN32__) -#define bzero(b,len) memset(b,0,len) #endif #ifdef HAVE_SIGNAL #include diff --git a/src/main/symbian/actsched.cpp b/src/main/symbian/actsched.cpp deleted file mode 100644 index 041c747..0000000 --- a/src/main/symbian/actsched.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/** - * @file actsched.cpp Symbian Active Scheduler - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include "../main.h" - -extern "C" { -#include -#include -#include - -#define DEBUG_MODULE "actsched" -#define DEBUG_LEVEL 5 -#include - -extern struct list *tmrl_get(void); -} - - -class CMyTimer : public CTimer -{ -public: - static CMyTimer *NewL(TInt aPriority); - void Start(); - -protected: - CMyTimer(TInt aPriority); - virtual void RunL(); -}; - -static CMyTimer *t; -static CActiveScheduler as; -static bool inited = false; -static bool running = false; - - -CMyTimer *CMyTimer::NewL(TInt aPriority) -{ - CMyTimer *t = new CMyTimer(aPriority); - t->ConstructL(); - return t; -} - - -CMyTimer::CMyTimer(TInt aPriority) - :CTimer(aPriority) -{ - CActiveScheduler::Add(this); -} - - -void CMyTimer::Start() -{ - Cancel(); - - /* - CTimer range is +-2147483647, which is +-35 minutes, 47 seconds. - */ - uint64_t to = tmr_next_timeout(tmrl_get()); - if (to) { - if (to >= 2147482) { - to = 2147482; - } - After(1000*to); - } - else { - DEBUG_INFO("idle.. no timers\n"); - } -} - - -void CMyTimer::RunL() -{ - tmr_poll(tmrl_get()); - - if (!t) - return; - - Start(); -} - - -void actsched_init(void) -{ - DEBUG_INFO("actsched init (inited=%d)\n", inited); - - if (inited) - return; - - inited = true; - - /* Setup the Active Scheduler */ - if (CActiveScheduler::Current()) { - DEBUG_INFO("Active Scheduler already installed\n"); - } - else { - DEBUG_INFO("Installing new Active Scheduler\n"); - CActiveScheduler::Install(&as); - } -} - - -int actsched_start(void) -{ - actsched_init(); - - DEBUG_INFO("actsched start: (running=%d)\n", running); - - if (running) { - DEBUG_WARNING("actsched start: already running\n"); - return EALREADY; - } - - running = true; - - if (!t) { - t = CMyTimer::NewL(0); - t->After(1000); - } - - /* Main loop */ - if (CActiveScheduler::Current() == &as) { - DEBUG_INFO("Starting own Active Scheduler\n"); - CActiveScheduler::Start(); /* loop here */ - running = false; - } - - return 0; -} - - -void actsched_stop(void) -{ - DEBUG_INFO("actsched stop (inited=%d)\n", inited); - - if (!running) - return; - - /* Must be called from same thread as ::Start() */ - if (CActiveScheduler::Current() == &as) { - DEBUG_INFO("Stopping own Active Scheduler\n"); - CActiveScheduler::Stop(); - } - - if (t) { - delete t; - t = NULL; - } - - inited = false; - running = false; -} - - -/* - * Called from tmr_start() when a new timer is added. - * - * TODO: this is a hack; consider moving it to tmr.c - */ -void actsched_restart_timer(void) -{ - if (!t) - return; - - t->Start(); -} diff --git a/src/mod/symbian/rlib.cpp b/src/mod/symbian/rlib.cpp deleted file mode 100644 index d3ab5ce..0000000 --- a/src/mod/symbian/rlib.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file rlib.cpp Dynamic library loading for Symbian - * - * Copyright (C) 2010 Creytiv.com - */ -#include -#include -#include "../mod_internal.h" - - -extern "C" { -#define DEBUG_MODULE "rlib" -#define DEBUG_LEVEL 5 -#include -} - - -void *_mod_open(const char *name) -{ - TBuf<128> buf; - TBuf8<128> buf8; - buf8.Copy((unsigned char *)name); - buf.Copy(buf8); - - DEBUG_INFO("rlib open (%s)\n", name); - - RLibrary *lib = new RLibrary; - if (!lib) { - DEBUG_WARNING("open: could not allocate RLibrary (%s)\n", - name); - return NULL; - } - TInt err = lib->Load(buf); - if (KErrNone != err) { - DEBUG_WARNING("open: Load failed with err=%d (%s)\n", err, - name); - delete lib; - return NULL; - } - - return lib; -} - - -void *_mod_sym(void *h, const char *symbol) -{ - RLibrary *lib = (RLibrary *)h; - - (void)symbol; - - /* NOTE: symbol lookup is done by ordinal. - */ - TLibraryFunction func = lib->Lookup(1); - TInt ret = func(); - - DEBUG_INFO("rlib sym: ret=0x%08x\n", func, ret); - - return (void *)ret; -} - - -void _mod_close(void *h) -{ - RLibrary *lib = (RLibrary *)h; - - delete lib; -} diff --git a/src/net/if.c b/src/net/if.c index 3bbde5f..88e5876 100644 --- a/src/net/if.c +++ b/src/net/if.c @@ -138,7 +138,6 @@ int net_if_getaddr(const char *ifname, int af, struct sa *ip) } -#ifndef __SYMBIAN32__ static bool if_debug_handler(const char *ifname, const struct sa *sa, void *arg) { @@ -174,7 +173,6 @@ int net_if_debug(struct re_printf *pf, void *unused) return err; } -#endif static bool linklocal_handler(const char *ifname, const struct sa *sa, diff --git a/src/net/sockopt.c b/src/net/sockopt.c index 247580c..2385a69 100644 --- a/src/net/sockopt.c +++ b/src/net/sockopt.c @@ -20,8 +20,6 @@ /** Platform independent buffer type cast */ #ifdef WIN32 #define BUF_CAST (char *) -#elif defined (__SYMBIAN32__) -#define BUF_CAST (void *) #else #define BUF_CAST #endif diff --git a/src/sys/fs.c b/src/sys/fs.c index e357bcc..c9bc805 100644 --- a/src/sys/fs.c +++ b/src/sys/fs.c @@ -83,14 +83,6 @@ int fs_gethome(char *path, size_t sz) return 0; -#elif defined(__SYMBIAN32__) - if (!path || !sz) - return EINVAL; - - str_ncpy(path, "c:\\Data", sz); - - return 0; - #elif defined(HAVE_PWD_H) const char *loginname; struct passwd *pw; diff --git a/src/sys/symbian/sleep.cpp b/src/sys/symbian/sleep.cpp deleted file mode 100644 index 4fd20bf..0000000 --- a/src/sys/symbian/sleep.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @file sleep.cpp System sleep for Symbian - * - * Copyright (C) 2010 Creytiv.com - */ - -#include - -extern "C" { -#include -#include -} - - -void sys_usleep(unsigned int us) -{ - User::After(us); -} diff --git a/src/sys/sys.c b/src/sys/sys.c index 0989dbb..687aa9f 100644 --- a/src/sys/sys.c +++ b/src/sys/sys.c @@ -98,9 +98,7 @@ int sys_kernel_get(struct re_printf *pf, void *unused) (void)unused; -#if defined (__SYMBIAN32__) - str = "Symbian OS"; -#elif defined(WIN32) +#if defined(WIN32) str = "Win32"; #else str = "?"; diff --git a/src/tcp/tcp.c b/src/tcp/tcp.c index a6367eb..68dc2d6 100644 --- a/src/tcp/tcp.c +++ b/src/tcp/tcp.c @@ -42,10 +42,6 @@ #define SOK_CAST (int) #define SIZ_CAST (int) #define close closesocket -#elif defined (__SYMBIAN32__) -#define BUF_CAST (void *) -#define SOK_CAST -#define SIZ_CAST #else #define BUF_CAST #define SOK_CAST diff --git a/src/udp/udp.c b/src/udp/udp.c index 38289d2..c1afee5 100644 --- a/src/udp/udp.c +++ b/src/udp/udp.c @@ -44,10 +44,6 @@ #define SOK_CAST (int) #define SIZ_CAST (int) #define close closesocket -#elif defined (__SYMBIAN32__) -#define BUF_CAST (void *) -#define SOK_CAST -#define SIZ_CAST #else #define BUF_CAST #define SOK_CAST