breakdeps/usocket.cpp
author William Roberts <williamr@symbian.org>
Mon, 11 Oct 2010 15:56:10 +0100
changeset 21 4a02a61ca23a
parent 20 37dc158a4522
permissions -rw-r--r--
Add stem_backend.dll to the stemkit build, to break the bluetooth.dll dependency
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
/*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
* Contributors:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
* Description:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
*/
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
#include <sys/types.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
#include <string.h>		// for memcpy
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
#include <fcntl.h>		// for struct stat
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
#include <sys/errno.h>		// for ENOTSOCK
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
#include <sys/socket.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
#include <sys/ioctl.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
#include <sys/stat.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
#include <netinet/in.h>		// for htons
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
#include <sys/sockio.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
#include <bt_sock.h>     // Symbian BT constantss needed for cooperation with Symbian sockets
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
#include <arpa/inet.h>   
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
#include <es_sock.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
#include <in_sock.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
#include <net/if.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
#include <commdb.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
#include <cdbcols.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
#include <commdbconnpref.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
#include <e32base.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
#include <e32err.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
#include <utf.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
#include <e32std.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
#include <net/route.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
#include <in_iface.h>
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
#include "fdesc.h"
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
#include "lposix.h"
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
#include "sysif.h"
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
// Support for struct sockaddr conversion
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
TUSockAddr::TUSockAddr (TAny* aBuf) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
: TSockAddr(), iError(0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
		Prepare(aBuf);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
void TUSockAddr::Prepare (TAny* aBuf) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
// Prepare a TUSockAddr to receive an address (used in RecvFrom)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
// Setting the length to 0 indicates that we don't really want this address anyway.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
	if (aBuf==0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
		SetLength(0);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
		iError = EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
EXPORT_C TUSockAddr::TUSockAddr (const TAny* aBuf, TUint aLen) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
: TSockAddr(), iError(0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
		Set(aBuf,aLen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
void TUSockAddr::Set (const TAny* aBuf, TUint aLen) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
// Construct an ESOCK TSockAddr from a struct sockaddr.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
// We have to deal with the network byte ordering of AF_INET addresses
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
	if (!aBuf)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
		iError = EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
		SetLength(0);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
	const TUint dataOffset = (TUint)&((struct sockaddr *)0)->sa_data[0];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
	// aLen should be atleast have minimum size.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
	if (aLen < dataOffset)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
		iError = EINVAL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
		SetLength(0);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
	const struct sockaddr* sp= (const struct sockaddr *)(aBuf);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
	TUint8 *from=(TUint8*)aBuf;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
	if (sp->sa_family==AF_INET)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
		{		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
		// byte-swap sockaddr_in back into host ordering
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
		TUint port=(from[2]<<8)+from[3];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
		from+=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
		TUint32 addr=(from[0]<<24)+(from[1]<<16)+(from[2]<<8)+from[3];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
		from+=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
		SetFamily(AF_INET);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
		SetPort(port);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   107
		*(TUint32*)UserPtr()=addr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   108
		SetUserLen(4);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   109
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
	else if (sp->sa_family == AF_INET6)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   112
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   113
		SetFamily(sp->sa_family);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   114
		SetPort(ByteOrder::Swap16(sp->sa_port));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   115
		from+=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   116
		// copy the rest of the data as given
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   117
		TUint8 *to=UserPtr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   118
		if (aLen<4)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   119
			aLen=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   120
		aLen-=4;	// skip fmaily and port
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   121
		if (aLen>24)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   122
			aLen=24;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   123
		memcpy(to,from,aLen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   124
		SetUserLen(aLen);    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   125
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   126
		}	
21
4a02a61ca23a Add stem_backend.dll to the stemkit build, to break the bluetooth.dll dependency
William Roberts <williamr@symbian.org>
parents: 20
diff changeset
   127
#if 0 // break dependency on bluetooth.dll
20
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   128
	else if (sp->sa_family == KBTAddrFamily)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   129
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   130
		// Make a TBTSockAddr from a sockaddr_bt...
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   131
		TBTSockAddr tmpAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   132
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   133
		// Family is always Bluetooth:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   134
		tmpAddr.SetFamily(KBTAddrFamily);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   135
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   136
		// The port number has the correct byte order already, as the
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   137
		// POSIX Bluetooth APIs assume litle-endian format:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   138
		tmpAddr.SetPort(sp->sa_port);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   139
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   140
		// For the address we need to reverse the byte ordering, as
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   141
		// Symbian appears to index Bluetooth addresses in a
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   142
		// big-endian manner:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   143
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   144
		const TInt KBTAddrLength = 6;  // Bytes in a Bluetooth address
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   145
		const TInt KBTAddrOffset = 4;  // Offset of address in sockaddr_bt
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   146
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   147
		TBTDevAddr devAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   148
		const TInt KMinLength = KBTAddrLength + KBTAddrOffset;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   149
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   150
		if (aLen >= KMinLength)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   151
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   152
			for (TInt i=0; i<KBTAddrLength; ++i)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   153
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   154
				devAddr[i] = from[KMinLength - 1 - i];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   155
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   156
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   157
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   158
		tmpAddr.SetBTAddr(devAddr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   159
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   160
		// Security settings:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   161
		TBTServiceSecurity sec;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   162
		sec.SetUid(TUid::Uid(0));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   163
		sec.SetAuthentication(EFalse);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   164
		sec.SetEncryption(EFalse);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   165
		sec.SetAuthorisation(EFalse);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   166
		sec.SetDenied(EFalse);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   167
		tmpAddr.SetSecurity(sec);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   168
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   169
		// Now we must copy the contents of the "tmpAddr" TBTSockAddr,
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   170
		// but unfortunately there isn't an assignment operator for us
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   171
		// to use. Still, we know it is a self-contained T class for
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   172
		// which a direct shallow copy using memcopy() will be ok:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   173
		//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   174
		memcpy(this, &tmpAddr, sizeof(TBTSockAddr));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   175
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   176
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   177
		}
21
4a02a61ca23a Add stem_backend.dll to the stemkit build, to break the bluetooth.dll dependency
William Roberts <williamr@symbian.org>
parents: 20
diff changeset
   178
#endif
20
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   179
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   180
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   181
		// Not AF_INET or KBTAddrFamily:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   182
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   183
		// expand the family and port
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   184
		SetFamily(sp->sa_family);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   185
		SetPort(sp->sa_port);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   186
		from+=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   187
		// copy the rest of the data as given
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   188
		TUint8 *to=UserPtr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   189
		if (aLen<4)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   190
			aLen=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   191
		aLen-=4;	// skip fmaily and port
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   192
		if (aLen>24)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   193
			aLen=24;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   194
		memcpy(to,from,aLen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   195
		SetUserLen(aLen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   196
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   197
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   198
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   199
/*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   200
 * Extract a struct sockaddr from a TSockAddr
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   201
 */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   202
EXPORT_C void TUSockAddr::Get(TAny* addr, unsigned long* len)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   203
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   204
	if (addr==0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   205
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   206
		iError = EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   207
		SetLength(0);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   208
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   209
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   210
	const TUint dataOffset = (TUint)&((struct sockaddr *)0)->sa_data[0];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   211
	// aLen should be atleast have minimum size.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   212
	if (*len < dataOffset)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   213
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   214
		iError = EINVAL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   215
		SetLength(0);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   216
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   217
		};
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   218
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   219
	struct sockaddr* sp=(struct sockaddr*)addr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   220
	TUint16 port=(TUint16)Port();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   221
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   222
	//The ipv4 address could be obtained either as
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   223
	//plain 32 bit address or as ipv4 mapped ipv6 address
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   224
	TInetAddr inetAddr(*this);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   225
	TBool isV4Mapped = (Family()==AF_INET6) && (inetAddr.IsV4Mapped() || inetAddr.IsV4Compat());
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   226
	if (Family()==AF_INET || isV4Mapped)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   227
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   228
		sp->sa_family=AF_INET;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   229
		sp->sa_port= ByteOrder::Swap16(port);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   230
		TUint8* from=UserPtr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   231
		TUint32 fromaddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   232
		//If the address is v4 mapped, we take the last 4 bytes from the 16 bytes long v6 structure. 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   233
		if(isV4Mapped)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   234
			fromaddr = (from[15]<<24)+(from[14]<<16)+(from[13]<<8)+from[12];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   235
		else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   236
			fromaddr = (from[0]<<24)+(from[1]<<16)+(from[2]<<8)+ from[3];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   237
		*(TUint32*)sp->sa_data=fromaddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   238
		*len=8;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   239
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   240
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   241
	else if (Family()==AF_INET6)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   242
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   243
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   244
		sp->sa_family=(TUint16)Family();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   245
		sp->sa_port=ByteOrder::Swap16(port);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   246
		TUint ulen=GetUserLen();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   247
		if (ulen+4>(*len))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   248
			ulen=(*len)-4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   249
		*len=ulen+4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   250
		memcpy(sp->sa_data,UserPtr(),ulen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   251
		sp->sa_len = ulen;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   252
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   253
		}		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   254
	else if (Family()==KBTAddrFamily)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   255
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   256
		sp->sa_family=KBTAddrFamily;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   257
		sp->sa_port=port;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   258
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   259
		const TInt KBTAddrLength = 6;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   260
		if (GetUserLen() == KBTAddrLength)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   261
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   262
			for (TInt i=0; i<KBTAddrLength; ++i)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   263
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   264
				sp->sa_data[KBTAddrLength - 1 - i] = UserPtr()[i];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   265
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   266
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   267
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   268
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   269
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   270
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   271
		// Not AF_INET or KBTAddrFamily:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   272
		sp->sa_family=(TUint16)Family();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   273
		sp->sa_port=port;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   274
		TUint ulen=GetUserLen();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   275
		if (ulen+4>(*len))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   276
			ulen=(*len)-4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   277
		*len=ulen+4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   278
		memcpy(sp->sa_data,UserPtr(),ulen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   279
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   280
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   281
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   282
// The Socket descriptor class
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   283
CSocketDesc::CSocketDesc()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   284
:iIoctlBuf(0,0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   285
iSocketPtr(NULL),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   286
iConnPref(),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   287
iConnectionPtr(NULL),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   288
iSubConnectionPtr(NULL),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   289
iRConnectionIndex(-1),		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   290
iSockServPtr(NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   291
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   292
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   293
		};
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   294
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   295
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   296
TInt CSocketDesc::Socket(RSocketServ& aSs, int family, int style, int protocol)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   297
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   298
	if (protocol == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   299
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   300
		if (family == AF_INET)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   301
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   302
			switch (style)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   303
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   304
				case SOCK_STREAM:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   305
					protocol = IPPROTO_TCP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   306
					break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   307
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   308
				case SOCK_DGRAM:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   309
					protocol = IPPROTO_UDP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   310
					break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   311
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   312
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   313
		else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   314
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   315
			protocol = KUndefinedProtocol;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   316
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   317
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   318
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   319
	iFcntlFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   320
	TInt err = CreateLock();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   321
	if (err)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   322
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   323
		return err;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   324
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   325
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   326
	if (family == AF_INET6)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   327
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   328
		err = iSocket.Open(aSs, KAfInet, style, protocol);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   329
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   330
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   331
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   332
		err = iSocket.Open(aSs, family, style, protocol);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   333
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   334
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   335
	if (err == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   336
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   337
		iStyle = style;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   338
		iSocket.Close(); // We will close now, to open later using connection preferences
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   339
		iAddrFamily = family;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   340
		iProtocol = protocol; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   341
		iSockServPtr = &aSs; // Saving the const session pointer for later use
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   342
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   343
	return err;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   344
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   345
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   346
TInt CSocketDesc::FinalClose()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   347
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   348
	CLocalSystemInterface* backend = Backend();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   349
	backend->DefConnLock().Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   350
	RHeap* oheap = User::SwitchHeap(backend->Heap());	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   351
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   352
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   353
		iSocketPtr = NULL;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   354
		StopInterface(NULL); // Checks for RConnection as well as RSubConnection
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   355
	    backend->RemoveSocket(this);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   356
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   357
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   358
	CSockDescBase::FinalClose();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   359
	User::SwitchHeap(oheap);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   360
	backend->DefConnLock().Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   361
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   362
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   363
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   364
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   365
void CSocketDesc::Read (TDes8& aBuf, TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   366
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   367
	//Acquire the Lock before read and release it later
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   368
	iReadLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   369
	if (iSocketPtr == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   370
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   371
		TInt ret = OpenUsingPreference();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   372
		if (ret != KErrNone)	// Error in open
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   373
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   374
			Complete(aStatus,ret);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   375
			iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   376
			return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   377
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   378
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   379
	CSockDescBase::Read (aBuf,aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   380
	iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   381
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   382
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   383
TInt CSocketDesc::ReadCompletion(TDes8& aBuf, TInt aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   384
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   385
	return CSockDescBase::ReadCompletion(aBuf, aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   386
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   387
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   388
void CSocketDesc::ReadCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   389
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   390
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   391
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   392
		CSockDescBase::ReadCancel();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   393
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   394
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   395
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   396
void CSocketDesc::Write (TDes8& aBuf, TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   397
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   398
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   399
    TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   400
    if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   401
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   402
        Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   403
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   404
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   405
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   406
	iWriteLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   407
	CSockDescBase::Write(aBuf, aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   408
	iWriteLock.Signal();	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   409
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   410
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   411
void CSocketDesc::WriteCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   412
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   413
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   414
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   415
		CSockDescBase::WriteCancel();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   416
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   417
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   418
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   419
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   420
TInt CSocketDesc::Bind(const struct sockaddr* aAddr, unsigned long aSize)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   421
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   422
	TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   423
	TUSockAddr addr(aAddr,aSize);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   424
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   425
	if (addr.iError != 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   426
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   427
		return addr.iError;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   428
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   429
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   430
	ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   431
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   432
	    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   433
	ATOMICSOCKETOP(ret = iSocket.Bind(addr),return KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   434
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   435
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   436
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   437
TInt CSocketDesc::Listen(TUint qSize)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   438
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   439
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   440
    TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   441
	if (iStyle == SOCK_DGRAM) // Listen on UDP socket, crashing at RSocket::Listen().
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   442
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   443
		return EOPNOTSUPP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   444
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   445
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   446
	ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   447
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   448
	    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   449
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   450
	return CSockDescBase::Listen(qSize);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   451
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   452
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   453
TInt CSocketDesc::SockName(int anEnd, struct sockaddr* anAddr,unsigned long* aSize)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   454
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   455
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   456
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   457
	if (!anAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   458
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   459
        return EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   460
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   461
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   462
	TInt ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   463
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   464
	    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   465
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   466
   
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   467
    struct sockaddr temp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   468
    unsigned long len = sizeof( temp );
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   469
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   470
	TUSockAddr nSockAddr(&temp, len );
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   471
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   472
	ret = CSockDescBase::SockName(anEnd,nSockAddr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   473
	if(ret == KErrNone )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   474
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   475
            nSockAddr.Get(&temp,&len );
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   476
            if( *aSize > len )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   477
                *aSize = len;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   478
            memcpy( anAddr,&temp,*aSize);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   479
            
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   480
            }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   481
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   482
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   483
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   484
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   485
TInt CSocketDesc::GetSockOpt(TInt anOptionName, TInt anOptionLevel, TDes8& anOption)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   486
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   487
	TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   488
	if (anOption.Ptr() == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   489
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   490
		return EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   491
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   492
	if (anOption.Length() == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   493
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   494
		return EINVAL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   495
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   496
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   497
	ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   498
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   499
	    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   500
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   501
	if (SO_TYPE == anOptionName && SOL_SOCKET == anOptionLevel)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   502
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   503
		TProtocolDesc protocolInfo;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   504
		ATOMICSOCKETOP(ret = iSocket.Info(protocolInfo), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   505
		if (KErrNone == ret )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   506
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   507
			// Copy the Socket Type to the buffer
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   508
			TInt size = (anOption.Length() < sizeof(protocolInfo.iSockType))? anOption.Length(): sizeof(protocolInfo.iSockType);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   509
			Mem::Copy((unsigned char*)anOption.Ptr(), &protocolInfo.iSockType, size);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   510
			anOption.SetLength(size);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   511
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   512
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   513
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   514
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   515
	if(IPPROTO_IP == anOptionLevel && IP_MULTICAST_IF == anOptionName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   516
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   517
		TUSockAddr addr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   518
		struct sockaddr_in sockAddress;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   519
		sockAddress.sin_family = AF_INET;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   520
		ATOMICSOCKETOP(sockAddress.sin_port = iSocket.LocalPort(),return KErrBadHandle)			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   521
		ATOMICSOCKETOP(iSocket.LocalName(addr);,return KErrBadHandle)		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   522
		TInt a = sizeof(sockAddress);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   523
		addr.Get(&sockAddress,(unsigned long*)&a);  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   524
		TInt size = (anOption.Length() < sizeof(sockAddress.sin_addr))? anOption.Length(): sizeof(sockAddress.sin_addr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   525
		Mem::Copy((unsigned char*)anOption.Ptr(), &(sockAddress.sin_addr), size); 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   526
		anOption.SetLength(size);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   527
		return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   528
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   529
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   530
	switch(anOptionLevel)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   531
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   532
		case IPPROTO_TCP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   533
			anOptionLevel=SOL_TCP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   534
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   535
		case IPPROTO_IP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   536
			anOptionLevel=SOL_IP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   537
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   538
		case SOL_SOCKET:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   539
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   540
			switch(anOptionName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   541
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   542
				case SO_REUSEADDR: 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   543
					anOptionLevel=SOL_IP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   544
					break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   545
				case SO_OOBINLINE:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   546
				case SO_KEEPALIVE:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   547
					anOptionLevel=SOL_TCP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   548
					break; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   549
				case SO_BROADCAST:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   550
					*((TInt*)anOption.Ptr()) = 1;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   551
					return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   552
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   553
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   554
		} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   555
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   556
	switch(anOptionName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   557
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   558
		case IP_MULTICAST_TTL:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   559
			anOptionLevel=KSolInetIp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   560
			anOptionName=KSoIp6MulticastHops;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   561
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   562
		case IP_MULTICAST_LOOP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   563
			anOptionLevel=KSolInetIp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   564
			anOptionName=KSoIp6MulticastLoop;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   565
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   566
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   567
	ATOMICSOCKETOP(ret = iSocket.GetOpt(anOptionName,anOptionLevel,anOption), return KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   568
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   569
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   570
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   571
TInt CSocketDesc::GetInterfaceIndex(TUint32 anAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   572
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   573
	TPckgBuf<TSoInetIfQuery> ifq;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   574
	TInt aIndex = -1;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   575
	if (KInetAddrAny == anAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   576
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   577
		aIndex = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   578
		return aIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   579
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   580
	else 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   581
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   582
		TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   583
		ATOMICSOCKETOP(ret = iSocket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   584
		if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   585
			return KErrGeneral;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   586
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   587
		TPckgBuf<TSoInetInterfaceInfo>iface;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   588
		ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   589
		while(ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   590
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   591
			TSoInetInterfaceInfo &info = iface();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   592
			TInt result;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   593
			if(info.iState == EIfUp)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   594
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   595
				if (anAddr == info.iAddress.Address()) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   596
					{      	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   597
					ifq().iName = info.iName;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   598
					ATOMICSOCKETOP( result = iSocket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifq), result = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   599
					if (result == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   600
						aIndex = ifq().iIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   601
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   602
					}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   603
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   604
			ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   605
			}   	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   606
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   607
	return aIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   608
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   609
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   610
TInt CSocketDesc::SetSockOpt(TInt anOptionName, TInt anOptionLevel, TDesC8& anOption)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   611
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   612
	TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   613
	if (anOption.Ptr() == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   614
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   615
		return EFAULT;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   616
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   617
	if (anOption.Length() == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   618
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   619
		return EINVAL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   620
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   621
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   622
	ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   623
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   624
	    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   625
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   626
	switch(anOptionLevel)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   627
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   628
		case IPPROTO_TCP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   629
			anOptionLevel=SOL_TCP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   630
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   631
		case IPPROTO_IP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   632
			anOptionLevel=SOL_IP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   633
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   634
		case SOL_SOCKET:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   635
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   636
			switch(anOptionName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   637
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   638
				case SO_REUSEADDR: 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   639
					anOptionLevel=SOL_IP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   640
					break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   641
				case SO_OOBINLINE:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   642
				case SO_KEEPALIVE:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   643
					anOptionLevel=SOL_TCP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   644
					break; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   645
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   646
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   647
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   648
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   649
	TPckgBuf<TIp6Mreq> req;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   650
	struct ip_mreq *mreq;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   651
	TInt aIndex = -1;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   652
	TUint8 *from;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   653
	TUint32 srcAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   654
	TUint32 maddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   655
	TInetAddr multiAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   656
	TInt *Option = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   657
	TInt ttlValue = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   658
	switch(anOptionName) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   659
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   660
		case IP_ADD_MEMBERSHIP:  //KSoIp6JoinGroup
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   661
		case IP_DROP_MEMBERSHIP: //KSoIp6LeaveGroup
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   662
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   663
			mreq = (struct ip_mreq *)anOption.Ptr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   664
			from = (TUint8 *)anOption.Ptr(); 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   665
			from+=4;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   666
			// swaping the byte order
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   667
			srcAddr = ByteOrder::Swap32( mreq->imr_interface.s_addr); 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   668
			//fetch the interface index
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   669
			aIndex = GetInterfaceIndex(srcAddr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   670
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   671
			// Set the multicast addr
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   672
			from = (TUint8 *)anOption.Ptr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   673
			maddr=(from[0]<<24)+(from[1]<<16)+(from[2]<<8)+from[3];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   674
			multiAddr.SetAddress( maddr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   675
			multiAddr.ConvertToV4Mapped();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   676
			if (multiAddr.IsMulticast())
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   677
			    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   678
                req().iAddr = multiAddr.Ip6Address();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   679
                req().iInterface = aIndex;  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   680
			    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   681
			ATOMICSOCKETOP( ret = iSocket.SetOpt(anOptionName, anOptionLevel, req), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   682
			return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   683
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   684
		case IP_MULTICAST_TTL:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   685
			anOptionLevel=KSolInetIp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   686
			anOptionName=KSoIp6MulticastHops;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   687
			Option = (TInt*)anOption.Ptr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   688
			ttlValue = *Option;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   689
			ATOMICSOCKETOP( ret = iSocket.SetOpt(anOptionName,anOptionLevel,ttlValue), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   690
			return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   691
			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   692
		case SO_BROADCAST: 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   693
			//check if user is trying to disable broadcast
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   694
			Option = (TInt*)anOption.Ptr();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   695
			return (*Option == 0 ? KErrNotSupported : KErrNone);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   696
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   697
		case IP_MULTICAST_IF:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   698
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   699
			//No support for equivalent flag KsoIp6MulticastIf presently
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   700
			//call bind instead	    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   701
			struct in_addr *inAddress = (struct in_addr*)anOption.Ptr();	    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   702
			struct sockaddr_in sockAddress; 	 		    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   703
			sockAddress.sin_family = AF_INET;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   704
			ATOMICSOCKETOP(sockAddress.sin_port = iSocket.LocalPort();,return KErrBadHandle)         
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   705
			sockAddress.sin_addr.s_addr = inAddress->s_addr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   706
			TUSockAddr ifAddress(&sockAddress, sizeof(sockAddress));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   707
			ATOMICSOCKETOP( ret = iSocket.Bind(ifAddress), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   708
			return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   709
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   710
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   711
		case IP_MULTICAST_LOOP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   712
			anOptionLevel=KSolInetIp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   713
			anOptionName=KSoIp6MulticastLoop;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   714
			break;	    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   715
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   716
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   717
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   718
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   719
	ATOMICSOCKETOP( ret = iSocket.SetOpt(anOptionName,anOptionLevel,anOption), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   720
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   721
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   722
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   723
void CSocketDesc::Sync (TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   724
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   725
	// Judging from the Solaris man pages, this does nothing.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   726
	Complete(aStatus,KErrNone);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   727
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   728
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   729
void CSocketDesc::RecvFrom(TDes8& aDesc, TSockAddr& from, int flags, TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   730
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   731
    TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   732
    if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   733
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   734
        Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   735
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   736
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   737
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   738
	iReadLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   739
	CSockDescBase::RecvFrom(aDesc, from, flags, aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   740
	iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   741
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   742
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   743
void CSocketDesc::RecvFromCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   744
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   745
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   746
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   747
		CSockDescBase::RecvFromCancel();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   748
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   749
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   750
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   751
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   752
void CSocketDesc::SendTo(TDes8& aDesc, const struct sockaddr* anAddr, unsigned long aAddrLen, int flags, TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   753
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   754
    TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   755
    if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   756
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   757
        Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   758
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   759
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   760
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   761
	TUSockAddr toAddr(anAddr, aAddrLen);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   762
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   763
	iWriteLock.Wait();  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   764
	CSockDescBase::SendTo(aDesc, toAddr, flags, aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   765
	iWriteLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   766
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   767
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   768
void CSocketDesc::SendToCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   769
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   770
// Should we use atomic loads here?
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   771
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   772
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   773
		CSockDescBase::SendToCancel();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   774
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   775
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   776
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   777
void CSocketDesc::Shutdown(TUint aHow,TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   778
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   779
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   780
    if (__e32_atomic_load_acq32(&iSocketPtr) == NULL) // Not opened at all. Nothing to do.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   781
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   782
		Complete(aStatus,KErrNone);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   783
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   784
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   785
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   786
	CSockDescBase::Shutdown(aHow,aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   787
	return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   788
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   789
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   790
void CSocketDesc::Accept(CFileDescBase*& aNewSocket, TRequestStatus& aStatus, RSocketServ& aSs, TSockAddr * /*aAddr*/)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   791
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   792
    aNewSocket = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   793
	TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   794
	if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   795
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   796
        Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   797
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   798
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   799
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   800
	iReadLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   801
	// what are the below coverity thingummichs?
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   802
	//coverity[alloc_fn]
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   803
	//coverity[assign]
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   804
	CSocketDesc *newSocket = new CSocketDesc;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   805
	if (!newSocket)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   806
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   807
        Complete(aStatus, KErrNoMemory);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   808
        iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   809
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   810
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   811
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   812
	err = newSocket->CreateLock();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   813
	if (err)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   814
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   815
        Complete(aStatus, KErrNoMemory);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   816
        delete newSocket;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   817
        iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   818
        //coverity[memory_leak]
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   819
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   820
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   821
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   822
	err = newSocket->iSocket.Open(aSs);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   823
	if (err)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   824
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   825
		Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   826
		newSocket->FinalClose();  // this will Close locks
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   827
		delete newSocket;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   828
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   829
		iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   830
		//coverity[memory_leak]
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   831
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   832
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   833
	newSocket->iSocketPtr = &newSocket->iSocket;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   834
	newSocket->iStyle = iStyle;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   835
	err = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   836
	ATOMICSOCKETOP( iSocket.Accept(newSocket->iSocket,aStatus), err = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   837
	if( err )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   838
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   839
	    Complete(aStatus, err);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   840
	    newSocket->FinalClose();  // this will Close locks
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   841
	    delete newSocket;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   842
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   843
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   844
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   845
	    aNewSocket = newSocket;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   846
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   847
	iReadLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   848
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   849
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   850
void CSocketDesc::AcceptCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   851
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   852
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   853
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   854
		ATOMICSOCKETOP( iSocket.CancelAccept(), NOP )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   855
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   856
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   857
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   858
void CSocketDesc::Connect(const struct sockaddr* aAddr,unsigned long size,TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   859
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   860
	TUSockAddr addr(aAddr,size);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   861
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   862
	if (addr.iError != 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   863
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   864
		aStatus = addr.iError;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   865
		return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   866
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   867
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   868
	TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   869
	if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   870
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   871
        aStatus = err;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   872
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   873
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   874
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   875
	iWriteLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   876
	if( GetConnectionProgress() == EFalse )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   877
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   878
		ATOMICSOCKETOP(iSocket.Connect(addr, aStatus), Complete(aStatus,KErrBadHandle))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   879
	    User::WaitForRequest(aStatus);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   880
	    if( aStatus.Int() == KErrWouldBlock )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   881
	        SetConnectionProgress(ETrue);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   882
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   883
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   884
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   885
	    aStatus = EALREADY;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   886
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   887
	iWriteLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   888
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   889
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   890
void CSocketDesc::ConnectCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   891
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   892
	if (iSocketPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   893
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   894
		ATOMICSOCKETOP(iSocket.CancelConnect(),NOP)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   895
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   896
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   897
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   898
void CSocketDesc::Ioctl(int aCmd, void* aParam, TRequestStatus& aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   899
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   900
	TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   901
	int* param = reinterpret_cast<int*>(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   902
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   903
	ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   904
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   905
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   906
        Complete(aStatus, ret);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   907
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   908
	    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   909
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   910
	switch ((unsigned)aCmd)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   911
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   912
		case FIONREAD:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   913
		case E32IONREAD:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   914
		    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   915
			ATOMICSOCKETOP( ret=iSocket.GetOpt(KSOReadBytesPending,KSOLSocket,*param), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   916
		    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   917
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   918
		case E32IOSELECT:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   919
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   920
			iIoctlBuf.Set((TText8*)aParam,4,4);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   921
			iIoctlLock.Wait();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   922
			iIoctlFlag = ETrue;		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   923
			ATOMICSOCKETOP(iSocket.Ioctl(KIOctlSelect,aStatus,&iIoctlBuf,KSOLSocket), Complete(aStatus,KErrBadHandle))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   924
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   925
			return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   926
		case SIOCGIFCONF:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   927
			ret = GetInterfaceList(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   928
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   929
		case SIOCGIFINDEX:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   930
			ret = GetInterfaceIndexByName(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   931
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   932
		case SIOCGIFACTIVECONF:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   933
			ret = GetActiveInterfaceList(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   934
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   935
		case SIOCSIFNAME:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   936
			ret = SetInterfaceByName(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   937
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   938
		case SIOCIFSTART:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   939
			ret = StartInterface(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   940
			if(KErrNone == ret)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   941
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   942
				iSocket.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   943
				iSocketPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   944
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   945
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   946
		case SIOCIFACTIVESTART:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   947
			ret = StartActiveInterface(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   948
			if(KErrNone == ret)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   949
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   950
				iSocket.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   951
				iSocketPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   952
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   953
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   954
		case SIOCIFSTOP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   955
			ret = StopInterface(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   956
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   957
		case SIOCATMARK:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   958
			ATOMICSOCKETOP(ret=iSocket.GetOpt(KSoTcpRcvAtMark,KSolInetTcp,*param), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   959
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   960
		case SIOCGIFADDR:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   961
			ret = GetIpAddress(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   962
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   963
		case SIOCGIFNUM:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   964
			ret = GetInterafceNumber(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   965
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   966
		case SIOCADDRT:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   967
			ret = RouteRequest(KSoInetAddRoute, aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   968
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   969
		case SIOCDELRT:		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   970
			ret = RouteRequest(KSoInetDeleteRoute, aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   971
			break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   972
		case SIOCGIFHWADDR:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   973
			ret = GetInterfaceHWAddress(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   974
		    break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   975
		case SIOCGIFACTIVEIAP:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   976
		    ret = GetActiveInterface( aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   977
		    break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   978
		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   979
		default:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   980
			ret=KErrNotSupported;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   981
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   982
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   983
	Complete(aStatus,ret);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   984
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   985
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   986
TInt CSocketDesc::IoctlCompletion(int /*aCmd*/, void* /*aParam*/, TInt aStatus)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   987
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   988
	if(iIoctlFlag)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   989
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   990
		iIoctlLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   991
		iIoctlFlag = EFalse;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   992
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   993
	return aStatus;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   994
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   995
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   996
void CSocketDesc::IoctlCancel()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   997
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   998
	if (iSocketPtr && iIoctlFlag)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
   999
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1000
		ATOMICSOCKETOP(iSocket.CancelIoctl(), NOP)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1001
		iIoctlLock.Signal();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1002
		iIoctlFlag = EFalse;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1003
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1004
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1005
// -----------------------------------------------------------------------------
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1006
// CSocketDesc::Fcntl
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1007
// Symbian Socket Specific Implementation for fcntl
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1008
// Implementation of fcntl for Socket will make use of  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1009
// RSocket::SetOpt(KSONonBlockingIO/KSOBlockingIO, KSOLSocket)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1010
// As of now fcntl supports F_SETFL and F_GETFL
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1011
// -----------------------------------------------------------------------------
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1012
//
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1013
TInt CSocketDesc::Fcntl(TUint anArg, TUint aCmd)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1014
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1015
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1016
    TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1017
    if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1018
        return err;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1019
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1020
    return CSockDescBase::Fcntl(anArg, aCmd);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1021
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1022
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1023
TInt CSocketDesc :: GetIpAddress( void *aParam )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1024
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1025
	TInetAddr myAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1026
	ATOMICSOCKETOP( iSocket.LocalName(myAddr), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1027
	TUint32 myIP = myAddr.Address();			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1028
	if (myIP == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1029
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1030
		return KErrGeneral;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1031
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1032
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1033
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1034
	((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr.s_addr = myIP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1035
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1036
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1037
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1038
TInt CSocketDesc :: GetRemoteIpAddress( void *aParam )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1039
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1040
	TInetAddr remoteAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1041
	ATOMICSOCKETOP( iSocket.RemoteName(remoteAddr), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1042
	TUint32 remoteIP = remoteAddr.Address();			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1043
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1044
	if (remoteIP == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1045
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1046
		return KErrGeneral;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1047
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1048
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1049
	((struct sockaddr_in *)&ifr->ifr_dstaddr)->sin_addr.s_addr = remoteIP;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1050
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1051
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1052
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1053
TInt CSocketDesc :: GetInterafceNumber( void *aParam )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1054
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1055
	TInt count = 0;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1056
	TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1057
	TRAP(ret, AccessPointCountL(count));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1058
	*(TInt *)aParam = count;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1059
	return ret;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1060
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1061
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1062
#ifdef __SYMBIAN_COMPILE_UNUSED__
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1063
TInt CSocketDesc :: GetInterafceParamInfo( void *aParam,TInt aType)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1064
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1065
	TInt ret = KErrNone;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1066
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1067
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1068
	TRAP(ret,FindConnectionInfoL(tempRecord,ifr->ifr_name));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1069
	if(ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1070
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1071
	wchar_t *str = (wchar_t *)( tempRecord.iServiceType.PtrZ());	 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1072
	TInt servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1073
	if(WcsCmp(str,L"LANService") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1074
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1075
		servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1076
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1077
	else if(WcsCmp(str,L"OutgoingGPRS") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1078
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1079
		servFlag  = 1;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1080
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1081
	if(aType == EACCESS_GETMETRIC)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1082
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1083
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETMETRIC);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1084
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1085
	else if(aType == EACCESS_GETMTU)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1086
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1087
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETMTU);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1088
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1089
	else if(aType == EACCESS_GETNETMASK)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1090
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1091
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETNETMASK);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1092
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1093
	else if(aType == EACCESS_GETBROADCAST)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1094
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1095
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETBROADCAST);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1096
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1097
	else if(aType == EACCESS_GETPHYSADDR)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1098
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1099
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETPHYSADDR);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1100
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1101
	else if(aType == EACCESS_GETFLAGS)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1102
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1103
		ret = GetInterfaceDetails(aParam,servFlag,EACCESS_GETFLAGS);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1104
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1105
	return ret;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1106
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1107
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1108
TInt CSocketDesc :: SetInterafceParamInfo( void *aParam,TInt aType)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1109
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1110
	TInt ret = KErrNone;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1111
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1112
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1113
	TRAP(ret,FindConnectionInfoL(tempRecord,ifr->ifr_name));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1114
	if(ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1115
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1116
	wchar_t *str = (wchar_t *)(tempRecord.iServiceType.PtrZ());	 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1117
	TInt servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1118
	if(WcsCmp(str,L"LANService") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1119
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1120
		servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1121
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1122
	else if(WcsCmp(str,L"OutgoingGPRS") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1123
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1124
		servFlag  = 1;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1125
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1126
	if(aType == EACCESS_SETMETRIC)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1127
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1128
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETMETRIC);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1129
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1130
	else if(aType == EACCESS_SETMTU)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1131
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1132
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETMTU);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1133
		}		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1134
	else if(aType == EACCESS_SETFLAGS)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1135
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1136
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETFLAGS);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1137
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1138
	else if(aType == EACCESS_SETPHYSADDR)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1139
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1140
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETPHYSADDR);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1141
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1142
	else if(aType == EACCESS_SETNETMASK)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1143
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1144
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETNETMASK);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1145
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1146
	else if(aType == EACCESS_SETBROADCAST)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1147
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1148
		ret = SetInterfaceDetails(aParam,servFlag,EACCESS_SETBROADCAST);					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1149
		}		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1150
	return ret;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1151
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1152
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1153
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1154
void CSocketDesc::FindConnectionInfoL(TAccessPointRecord &aRecord,char *ptr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1155
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1156
	//TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1157
	CCommsDatabase* iapDatabase;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1158
	CCommsDbTableView* view;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1159
	TInt res;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1160
	TPtrC8 tptr((TText8*)ptr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1161
	TBuf<KCommsDbSvrMaxColumnNameLength> temp;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1162
	res = CnvUtfConverter::ConvertToUnicodeFromUtf8(temp, tptr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1163
	if(res < KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1164
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1165
		User::Leave(res);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1166
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1167
	else if(res > KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1168
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1169
		User::Leave(KErrOverflow);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1170
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1171
	// This function can leave on insufficient memory
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1172
	OpenIapTableLC(&iapDatabase, &view);	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1173
	res = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1174
	while (res == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1175
		{    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1176
		// On error continue with the next record	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1177
		TRAP( res,ReadRecordFromIapTableL(view, aRecord));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1178
		if (res == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1179
			{   
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1180
			if(WcsCmp ((wchar_t*)aRecord.iName.PtrZ(),(wchar_t*)temp.PtrZ()) == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1181
				break; 	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1182
			}    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1183
		res = view->GotoNextRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1184
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1185
	CleanupStack::PopAndDestroy();// view
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1186
	CleanupStack::PopAndDestroy(iapDatabase);	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1187
	return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1188
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1189
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1190
TInt CSocketDesc :: SetInterfaceDetails( void *aParam ,TInt aFlag, TInt aType )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1191
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1192
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1193
	TPckgBuf<TSoInetIfQuery> ifq;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1194
	TBuf8 <25> ipBuf8;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1195
	TName aBuf;			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1196
	TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1197
	ATOMICSOCKETOP( ret = iSocket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1198
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1199
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1200
		return KErrGeneral;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1201
		}    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1202
	TPckgBuf<TSoInet6InterfaceInfo> info;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1203
	TSoInet6InterfaceInfo &in = info();	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1204
	ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1205
	while(ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1206
		{			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1207
		if(info().iName != _L("") && info().iName != _L("loop6") && info().iName != _L("loop4"))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1208
			{   			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1209
			TDes16& aName = info().iName;							
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1210
			if( ((aFlag == 0 ) && ( aName.FindC(_L("WLAN")) != KErrNotFound )) ||
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1211
					((aFlag == 1) && (aName.FindC(_L("Generic")) != KErrNotFound )) )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1212
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1213
				switch(aType)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1214
					{				
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1215
					case  EACCESS_SETMETRIC:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1216
						if(info().iState == EIfUp)										 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1217
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1218
							info().iSpeedMetric =  ifr->ifr_metric;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1219
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1220
						goto setout;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1221
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1222
					case  EACCESS_SETMTU:										 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1223
						if(info().iState == EIfUp)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1224
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1225
							info().iMtu = ifr->ifr_mtu ;		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1226
							}		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1227
						goto setout;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1228
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1229
					case  EACCESS_SETNETMASK :																																																					
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1230
						// Presently netmask address is NULL											
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1231
						if((info().iState == EIfUp) && (ifr->ifr_addr.sa_data !=NULL))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1232
							{																																																		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1233
							/*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1234
							CharToTBuf8(ifr->ifr_addr.sa_data,ipBuf8);											
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1235
											if (CnvUtfConverter::ConvertToUnicodeFromUtf8( aBuf,ipBuf8 ) == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1236
											{													
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1237
												ret = info().iNetMask.Input(aBuf);												
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1238
											}																							
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1239
							info().iNetMask.SetAddress(INET_ADDR(255,255,255,0));	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1240
							*/
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1241
							return KErrNotSupported;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1242
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1243
						break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1244
					case  EACCESS_SETBROADCAST :										
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1245
						if((info().iState == EIfUp) && (ifr->ifr_broadaddr.sa_data !=NULL))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1246
							{																																																		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1247
							/*CharToTBuf8(ifr->ifr_broadaddr.sa_data,ipBuf8);											
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1248
											if (CnvUtfConverter::ConvertToUnicodeFromUtf8( aBuf,ipBuf8 ) == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1249
											{													
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1250
												ret = info().iBrdAddr.Input(aBuf);												
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1251
											} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1252
							*/												
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1253
							return KErrNotSupported;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1254
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1255
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1256
						break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1257
					case  EACCESS_SETPHYSADDR :										
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1258
						// Currently no imeplentation is given as KIfHasHardwareAddr is always 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1259
						// set to 0 for wlan and GPRS
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1260
						if(info().iFeatures&KIfHasHardwareAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1261
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1262
							return KErrNotSupported;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1263
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1264
						break;									
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1265
					case  EACCESS_SETFLAGS :										
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1266
						info().iFeatures = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1267
						// Interface UP
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1268
						if((ifr->ifr_flags & IFF_UP) && (ifr->ifr_flags & IFF_DRV_RUNNING)) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1269
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1270
							info().iState = EIfUp;																						
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1271
							}																						
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1272
						else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1273
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1274
							info().iState = EIfDown;																																	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1275
							}																																	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1276
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1277
						// Loopback										
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1278
						if(ifr->ifr_flags & IFF_LOOPBACK)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1279
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1280
							info().iFeatures |= KIfIsLoopback;																				            													           
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1281
							}																				            													           
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1282
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1283
						// point to point support
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1284
						if(ifr->ifr_flags &  IFF_POINTOPOINT)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1285
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1286
							info().iFeatures |= KIfIsPointToPoint; 							                
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1287
							} 							                
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1288
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1289
						// Broadcast
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1290
						if(ifr->ifr_flags & IFF_BROADCAST)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1291
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1292
							info().iFeatures |=KIfCanBroadcast; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1293
							} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1294
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1295
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1296
						// Multicast
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1297
						if(ifr->ifr_flagshigh & IFF_MULTICAST)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1298
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1299
							info().iFeatures = KIfCanMulticast;							            	      
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1300
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1301
						//these flags details are available in symbian but not used by lib layer.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1302
						/* if(info().iFeatures&KIfCanSetMTU)			            	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1303
							               if(info().iFeatures&KIfHasHardwareAddr)    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1304
							               if(info().iFeatures&KIfCanSetHardwareAddr) */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1305
						goto setout;							            	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1306
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1307
					default:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1308
						break;					 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1309
					}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1310
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1311
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1312
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1313
		ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1314
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1315
	setout:	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1316
	TPckgBuf<TSoInet6InterfaceInfo> changeToNew(info());
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1317
	ATOMICSOCKETOP(ret = iSocket.SetOpt(KSoInetConfigInterface, KSolInetIfCtrl,changeToNew), return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1318
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1319
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1320
#endif // __SYMBIAN_COMPILE_UNUSED__
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1321
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1322
TInt CSocketDesc::GetInterfaceDetails( void *aParam ,TInt aFlag, TInt aType )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1323
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1324
	TPckgBuf<TSoInetIfQuery> ifq;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1325
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1326
	TInt ret = KErrNone; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1327
	ATOMICSOCKETOP( ret = iSocket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1328
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1329
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1330
		return KErrGeneral;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1331
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1332
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1333
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1334
    *(ifr->ifr_addr.sa_data) = '\0';
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1335
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1336
	TPckgBuf<TSoInetInterfaceInfo> info;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1337
	ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1338
	while( ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1339
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1340
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1341
		if(info().iName != _L("") && info().iName != _L("loop6") && info().iName != _L("loop4"))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1342
			{   
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1343
			TDes16& aName = info().iName;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1344
			TName aBuf;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1345
			TBuf8<KMaxName> ipAddr;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1346
			if( ((aFlag == 0 ) && ( aName.FindC(_L("WLAN")) != KErrNotFound )) ||
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1347
					((aFlag == 1) && (aName.FindC(_L("Generic")) != KErrNotFound )) )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1348
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1349
				switch(aType)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1350
					{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1351
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1352
					case  EACTIVE_GETIP :
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1353
						if((info().iState == EIfUp) && (info().iAddress.Address() != NULL))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1354
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1355
							if(!((info().iAddress.IsLinkLocal()) || (info().iAddress.IsSiteLocal())))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1356
								{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1357
								info().iAddress.Output(aBuf);  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1358
								if (CnvUtfConverter::ConvertFromUnicodeToUtf8( ipAddr, aBuf ) == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1359
									{			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1360
									StrlCopy(ifr->ifr_addr.sa_data,(const char *) ipAddr.PtrZ(),ipAddr.Length()+1);														
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1361
									}  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1362
								}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1363
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1364
						break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1365
					case  EACCESS_GETMETRIC:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1366
						ifr->ifr_metric = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1367
						if (info().iState == EIfUp)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1368
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1369
							ifr->ifr_metric = info().iSpeedMetric;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1370
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1371
						break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1372
					case  EACCESS_GETMTU:
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1373
						ifr->ifr_mtu = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1374
						if (info().iState == EIfUp)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1375
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1376
							ifr->ifr_mtu = info().iMtu;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1377
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1378
						break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1379
					case  EACCESS_GETNETMASK :
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1380
						*(ifr->ifr_addr.sa_data) = '\0';
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1381
						// Presently netmask address is NULL
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1382
						if((info().iState == EIfUp) && (info().iNetMask.Address() != NULL))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1383
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1384
							//anAddr = info().iNetMask.Address();	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1385
							info().iNetMask.Output(aBuf);  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1386
							if (CnvUtfConverter::ConvertFromUnicodeToUtf8( ipAddr, aBuf ) == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1387
								{			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1388
								StrlCopy(ifr->ifr_addr.sa_data,(const char *) ipAddr.PtrZ(),ipAddr.Length()+1);												
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1389
								}  											
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1390
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1391
						break;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1392
					case  EACCESS_GETBROADCAST :
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1393
						*(ifr->ifr_broadaddr.sa_data) = '\0';
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1394
						// Presently Breaodcast address is NULL
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1395
						if((info().iState == EIfUp) && (info().iBrdAddr.Address() != NULL))
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1396
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1397
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1398
							//anAddr = info().iBrdAddr.Address();	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1399
							info().iBrdAddr.Output(aBuf);  
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1400
							if (CnvUtfConverter::ConvertFromUnicodeToUtf8( ipAddr, aBuf ) == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1401
								{			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1402
								StrlCopy(ifr->ifr_broadaddr.sa_data,(const char *) ipAddr.PtrZ(),ipAddr.Length()+1);												
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1403
								}											
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1404
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1405
						break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1406
					case  EACCESS_GETPHYSADDR :
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1407
						ifr->ifr_phys = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1408
						// Currently no imeplentation is given as KIfHasHardwareAddr is always 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1409
						// set to 0 for wlan and GPRS
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1410
						if(info().iFeatures&KIfHasHardwareAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1411
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1412
							//nada.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1413
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1414
						break;									
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1415
					case  EACCESS_GETFLAGS :
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1416
						ifr->ifr_flags = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1417
						ifr->ifr_flagshigh=0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1418
						// Interface UP
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1419
						if(info().iState == EIfUp)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1420
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1421
							ifr->ifr_flags |= IFF_UP; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1422
							ifr->ifr_flags |= IFF_DRV_RUNNING;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1423
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1424
						// Loopback
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1425
						if(info().iFeatures&KIfIsLoopback)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1426
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1427
							ifr->ifr_flags |= IFF_LOOPBACK;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1428
							}										            													           
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1429
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1430
						// point to point support
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1431
						if(info().iFeatures&KIfIsPointToPoint) 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1432
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1433
							ifr->ifr_flags |= IFF_POINTOPOINT;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1434
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1435
						
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1436
						// Broadcast
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1437
						if(info().iFeatures&KIfCanBroadcast)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1438
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1439
							ifr->ifr_flags |= IFF_BROADCAST;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1440
							}      
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1441
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1442
						// Multicast
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1443
						if(info().iFeatures&KIfCanMulticast)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1444
							{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1445
							ifr->ifr_flagshigh |= ((IFF_MULTICAST & 0xff00) >> 8);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1446
							}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1447
						//these flags details are available in symbian but not used by lib layer.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1448
						/* if(info().iFeatures&KIfCanSetMTU)			            	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1449
							               if(info().iFeatures&KIfHasHardwareAddr)    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1450
							               if(info().iFeatures&KIfCanSetHardwareAddr) */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1451
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1452
						break;																 				 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1453
				 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1454
					}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1455
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1456
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1457
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1458
		ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1459
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1460
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1461
	return KErrNone;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1462
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1463
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1464
TInt CSocketDesc::Poll(TPollMode aMode,TBool& aReadyStatus,TInt& aErrno)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1465
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1466
	TInt ret = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1467
    if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1468
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1469
        return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1470
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1471
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1472
    TInt status;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1473
    ATOMICSOCKETOP(ret = iSocket.GetOpt(KSOSelectPoll, KSOLSocket, status), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1474
    if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1475
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1476
    	aReadyStatus = status & aMode;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1477
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1478
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1479
    return MapError(ret, aErrno);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1480
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1481
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1482
/* The synchronous - non-blocking Poll */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1483
TInt CSocketDesc::Poll(TUint aEvents)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1484
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1485
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1486
    TInt err = maybe_reopen_socket();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1487
	if (err != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1488
	    return err;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1489
		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1490
	return CSockDescBase::Poll(aEvents);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1491
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1492
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1493
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1494
/* Cancel an outstanding notification request */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1495
void CSocketDesc::CancelNotify()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1496
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1497
	CSockDescBase::CancelNotify();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1498
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1499
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1500
TAccessPointRecord::TAccessPointRecord()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1501
:iId(0), 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1502
iName(0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1503
iDialogPref(ECommDbDialogPrefDoNotPrompt),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1504
iDirection(ECommDbConnectionDirectionUnknown), 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1505
iService(0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1506
iServiceType(0), // Text value
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1507
iBearer(0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1508
iBearerType(0),	// Text value
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1509
iNetwork(0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1510
iNetworkWeighting(0),
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1511
iLocation(0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1512
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1513
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1514
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1515
inline TInt CSocketDesc::GetInterfaceList(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1516
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1517
	return GetInterface(aParam, EACCESS_POINT);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1518
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1519
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1520
TInt CSocketDesc::GetInterfaceIndexByName(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1521
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1522
	ifreq *ifrQuery = (ifreq*)aParam;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1523
	ifconf ifc;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1524
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1525
	// Know how many interfaces
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1526
	ifc.ifc_len = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1527
	ifc.ifc_buf = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1528
	TInt ret = GetInterface(&ifc, EACCESS_POINT);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1529
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1530
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1531
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1532
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1533
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1534
	// Allocate the memory to get the detail interface information
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1535
	ifc.ifc_buf = (caddr_t)Backend()->Alloc( ifc.ifc_len);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1536
	if (ifc.ifc_buf == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1537
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1538
		return KErrNoMemory;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1539
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1540
	ret = GetInterface(&ifc, EACCESS_POINT);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1541
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1542
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1543
		Backend()->Free(ifc.ifc_buf);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1544
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1545
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1546
	ifreq *ifr = ifc.ifc_req;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1547
	TInt ifCount = ifc.ifc_len / sizeof(ifreq);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1548
	TInt i = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1549
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1550
	// We wouldn't need this if we were using a StrNcmp below
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1551
	ifrQuery->ifr_name[IFNAMSIZ-1] = 0; // don't assume NULL terminated input
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1552
	// Search for the interface name
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1553
	for (; i < ifCount; i++, ifr++)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1554
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1555
		if ( StrCmp(ifrQuery->ifr_name, ifr->ifr_name) == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1556
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1557
			ifrQuery->ifr_index = ifr->ifr_index;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1558
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1559
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1560
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1561
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1562
	if (i == ifCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1563
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1564
		ret = KErrNotFound;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1565
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1566
	Backend()->Free(ifc.ifc_buf);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1567
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1568
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1569
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1570
inline TInt CSocketDesc::GetActiveInterfaceList(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1571
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1572
	return GetInterface(aParam, EACTIVE_CONNECTION);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1573
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1574
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1575
TInt CSocketDesc::GetInterface(void *aParam, TInt aType)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1576
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1577
	TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1578
	ifconf *ifc = (ifconf*)aParam;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1579
	TInt length = (ifc->ifc_len) / sizeof(ifreq);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1580
	TInt count = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1581
	// If the length is zero, fill the number of interface information
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1582
	if ( length <= 0 || ifc->ifc_buf == NULL )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1583
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1584
		if (aType == EACCESS_POINT)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1585
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1586
			TRAP(ret, AccessPointCountL(count));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1587
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1588
		else if (aType == EACTIVE_CONNECTION)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1589
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1590
			ret = ActiveConnectionCount(count);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1591
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1592
		else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1593
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1594
			ret = KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1595
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1596
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1597
		if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1598
		    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1599
            ifc->ifc_len = sizeof(ifreq) * count;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1600
		    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1601
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1602
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1603
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1604
	// length is not 0, read 'length' number of records
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1605
	CArrayFixFlat<TAccessPointRecord> *apArray;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1606
	wchar_t *str;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1607
	TInt apIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1608
	TInt result = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1609
	ifreq *ifr = ifc->ifc_req;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1610
	TInt ActiveSet = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1611
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1612
	// Fixed array of 'length'
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1613
	apArray = new CArrayFixFlat<TAccessPointRecord>(length);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1614
	if (apArray == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1615
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1616
		return KErrNoMemory;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1617
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1618
	if (aType == EACCESS_POINT)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1619
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1620
		// On return length would contain the number of access points.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1621
		TRAP(result, AccessPointListL(apArray, length));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1622
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1623
	else if (aType == EACTIVE_CONNECTION)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1624
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1625
		TRAP(ret, ret=ActiveConnectionListL(apArray, length));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1626
		if( ret == KErrNone )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1627
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1628
			TRAP(ret,FindConnectionDetailsL(apArray, length));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1629
			ActiveSet = 1;  	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1630
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1631
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1632
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1633
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1634
		delete apArray;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1635
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1636
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1637
	for (apIndex = 0; apIndex < length; apIndex++,ifr++)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1638
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1639
		TAccessPointRecord& ref = (*apArray)[apIndex];
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1640
		ifr->ifr_name[IFNAMSIZ-1] = 0; // don't assume NULL terminated input
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1641
		TPtr8 ptr((TText8*)ifr->ifr_name, IFNAMSIZ);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1642
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1643
		ret = CnvUtfConverter::ConvertFromUnicodeToUtf8(ptr, ref.iName);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1644
		if(ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1645
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1646
			if(ptr.Length() < ptr.MaxLength())
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1647
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1648
				ptr.ZeroTerminate();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1649
				} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1650
			else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1651
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1652
				return KErrOverflow;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1653
				} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1654
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1655
		else if (ret > KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1656
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1657
			return KErrOverflow;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1658
			} 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1659
		else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1660
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1661
			return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1662
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1663
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1664
		// Copy theinterface index
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1665
		ifr->ifr_index = ref.iId;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1666
		if(ActiveSet == 1)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1667
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1668
			str = (wchar_t *)(ref.iServiceType.PtrZ() ); 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1669
			TInt servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1670
			if(WcsCmp(str,L"LANService") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1671
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1672
				servFlag = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1673
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1674
			else if(WcsCmp(str,L"OutgoingGPRS") == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1675
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1676
				servFlag  = 1;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1677
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1678
			GetInterfaceDetails(ifr,servFlag,EACTIVE_GETIP);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1679
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1680
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1681
	ifc->ifc_len = sizeof(ifreq) * apIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1682
	delete apArray;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1683
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1684
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1685
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1686
TInt CSocketDesc::SetInterfaceByName(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1687
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1688
	ifreq *ifr = (ifreq *)aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1689
	if (!ifr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1690
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1691
		return KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1692
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1693
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1694
	ifr->ifr_name[IFNAMSIZ-1] = 0; // don't assume NULL terminated input
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1695
	TPtrC8 ptr((TText8*)ifr->ifr_name);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1696
	TInt ret = CnvUtfConverter::ConvertToUnicodeFromUtf8(iConnPref.iName,ptr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1697
	if(ret > KErrNone )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1698
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1699
		return KErrOverflow;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1700
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1701
	return ret; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1702
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1703
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1704
inline TInt CSocketDesc::StartInterface(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1705
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1706
	return StartConnection(aParam);	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1707
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1708
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1709
inline TInt CSocketDesc::StartActiveInterface(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1710
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1711
	return StartSubConnection(aParam);	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1712
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1713
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1714
TInt CSocketDesc::StopInterface(void *)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1715
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1716
	if (iConnectionPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1717
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1718
		StopConnection();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1719
		return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1720
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1721
	else if (iSubConnectionPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1722
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1723
		StopSubConnection();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1724
		return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1725
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1726
	return KErrNotFound;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1727
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1728
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1729
TInt CSocketDesc::OpenUsingPreference()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1730
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1731
	TInt ret = 0;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1732
    // Update when supporting INET6
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1733
    TInt addrfamily = (iAddrFamily == AF_INET6 ? KAfInet : iAddrFamily);	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1734
	if (iConnectionPtr != NULL) // iConnection initialized
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1735
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1736
		ret = iSocket.Open(*iSockServPtr,addrfamily,iStyle,iProtocol,iConnection);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1737
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1738
	else if (iSubConnectionPtr != NULL) // iSubConnection initialized
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1739
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1740
		ret = iSocket.Open(*iSockServPtr,addrfamily,iStyle,iProtocol,iSubConnection);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1741
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1742
	else
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1743
	    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1744
	    RConnection& defConnection = Backend()->GetDefaultConnection();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1745
	    //Now check if the default connection is intialized. This is given lesser 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1746
	     //priority than the socket specific preferences checked above.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1747
	     if(defConnection.SubSessionHandle() != 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1748
	         {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1749
	         ret = iSocket.Open(*iSockServPtr,addrfamily,iStyle,iProtocol,defConnection);	         
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1750
	         if (!ret)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1751
	             {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1752
	             Backend()->AddSocket(this);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1753
	             }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1754
	         }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1755
	     else // No connection preference is set
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1756
	         {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1757
	         ret = ECONNABORTED;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1758
            }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1759
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1760
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1761
    if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1762
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1763
        __e32_atomic_store_rel32(&iSocketPtr, (unsigned long)&iSocket);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1764
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1765
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1766
    iConnectInProgress = EFalse;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1767
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1768
    return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1769
    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1770
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1771
void CSocketDesc::TempClose()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1772
    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1773
    TUint32 ret = __e32_atomic_ior_ord32((void *)&iCount,0x8000);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1774
    if( ret >= 0x8000 )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1775
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1776
        // This indicates a TempClose has already been done from one of the threads
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1777
        return;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1778
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1779
    // loop and yeild till no more references are held to the iSocket
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1780
    while( iCount != 0x8000 )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1781
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1782
        // Yeild for 1 ms
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1783
        User::After(1000);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1784
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1785
    if (iSocket.SubSessionHandle() != 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1786
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1787
	    iSocketPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1788
        iSocket.CancelAll();    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1789
        TRequestStatus status;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1790
        iSocket.Shutdown(RSocket::EImmediate, status);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1791
        User::WaitForRequest(status);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1792
        iSocket.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1793
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1794
    }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1795
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1796
void CSocketDesc::AccessPointListL(CArrayFixFlat<TAccessPointRecord> *&aRecordPtr,
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1797
		TInt &aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1798
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1799
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1800
	CCommsDatabase* iapDatabase;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1801
	CCommsDbTableView* view;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1802
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1803
	// This function can leave on insufficient memory
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1804
	OpenIapTableLC(&iapDatabase, &view);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1805
	TInt count = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1806
	TInt ret = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1807
    while (ret == KErrNone && count < aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1808
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1809
    	TRAP(ret, ReadRecordFromIapTableL(view, tempRecord));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1810
    	if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1811
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1812
			aRecordPtr->AppendL(tempRecord);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1813
			count++;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1814
			}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1815
    	ret = view->GotoNextRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1816
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1817
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1818
	CleanupStack::PopAndDestroy();// view
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1819
	CleanupStack::PopAndDestroy(iapDatabase);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1820
	aCount = aRecordPtr->Count();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1821
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1822
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1823
void CSocketDesc::FindConnectionDetailsL(CArrayFixFlat<TAccessPointRecord> *&aRecordPtr,
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1824
		TInt &aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1825
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1826
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1827
	CCommsDatabase* iapDatabase;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1828
	CCommsDbTableView* view;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1829
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1830
	// This function can leave on insufficient memory
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1831
	OpenIapTableLC(&iapDatabase, &view);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1832
	TInt count = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1833
	TInt ret = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1834
    while (ret == KErrNone && count < aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1835
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1836
    	TRAP(ret, ReadRecordFromIapTableL(view, tempRecord));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1837
    	if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1838
			{    		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1839
			if((*aRecordPtr)[count].iId == tempRecord.iId )    			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1840
				{    			    		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1841
				(*aRecordPtr)[count].iServiceType = tempRecord.iServiceType;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1842
				ret = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1843
				count++;    		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1844
				continue;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1845
				}    		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1846
    		ret = view->GotoNextRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1847
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1848
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1849
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1850
	CleanupStack::PopAndDestroy();// view
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1851
	CleanupStack::PopAndDestroy(iapDatabase);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1852
	aCount = aRecordPtr->Count();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1853
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1854
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1855
void CSocketDesc::AccessPointCountL(TInt &aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1856
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1857
	CCommsDatabase* iapDatabase;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1858
	CCommsDbTableView* view;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1859
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1860
	OpenIapTableLC(&iapDatabase, &view);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1861
	aCount = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1862
	TInt ret = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1863
	while(ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1864
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1865
		aCount++;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1866
		ret = view->GotoNextRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1867
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1868
	CleanupStack::PopAndDestroy();// view
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1869
	CleanupStack::PopAndDestroy(iapDatabase);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1870
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1871
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1872
void CSocketDesc::ReadRecordFromIapTableL(CCommsDbTableView* aView, TAccessPointRecord &aRecord)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1873
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1874
	aView->ReadUintL(TPtrC(COMMDB_ID), aRecord.iId);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1875
	aView->ReadTextL(TPtrC(COMMDB_NAME), aRecord.iName); 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1876
	aRecord.iDialogPref = ECommDbDialogPrefDoNotPrompt;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1877
	aView->ReadUintL(TPtrC(IAP_SERVICE), aRecord.iService);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1878
	aView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), aRecord.iServiceType);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1879
	aView->ReadUintL(TPtrC(IAP_BEARER), aRecord.iBearer);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1880
	/*
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1881
	 * IAP_BEARER_TYPE is not a column of IAP table even though its 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1882
	 * listed in header. So not trying to read it.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1883
	 */
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1884
	aView->ReadUintL(TPtrC(IAP_NETWORK), aRecord.iNetwork);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1885
	aView->ReadUintL(TPtrC(IAP_NETWORK_WEIGHTING), aRecord.iNetworkWeighting);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1886
	aView->ReadUintL(TPtrC(IAP_LOCATION), aRecord.iLocation);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1887
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1888
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1889
void CSocketDesc::OpenIapTableLC(CCommsDatabase **aIapDatabase, CCommsDbTableView **aView)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1890
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1891
	// Get IAP names and ids from the database
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1892
	*aIapDatabase = CCommsDatabase::NewL(EDatabaseTypeIAP);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1893
	CleanupStack::PushL(*aIapDatabase);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1894
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1895
	(*aIapDatabase)->ShowHiddenRecords();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1896
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1897
	// This is LC code, that means code has pushed, but not popped
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1898
	(*aView) = (*aIapDatabase)->OpenTableLC(TPtrC(IAP));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1899
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1900
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1901
inline TInt CSocketDesc::ActiveConnectionCount(TInt &aCount)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1902
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1903
	aCount = ((CFileTable*)iFids)->RConnectionCount();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1904
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1905
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1906
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1907
TInt CSocketDesc::ActiveConnectionListL(CArrayFixFlat<TAccessPointRecord> *aRecordPtr, TInt &aLength)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1908
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1909
	TInt rcIndex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1910
	RConnection *rc;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1911
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1912
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1913
	for (rcIndex = 0;rcIndex < aLength; rcIndex++)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1914
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1915
		if  ( ((CFileTable*)iFids)->RConnectionAt(rcIndex, rc) != KErrNone )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1916
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1917
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1918
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1919
		// Read index and name of the connection
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1920
		if  ( GetRConnectionDetails(rc, tempRecord) != KErrNone )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1921
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1922
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1923
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1924
		aRecordPtr->AppendL(tempRecord);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1925
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1926
	aLength = aRecordPtr->Count();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1927
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1928
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1929
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1930
TInt CSocketDesc::GetRConnectionDetails(RConnection *aRc, TAccessPointRecord &aApr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1931
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1932
	_LIT(KName, "IAP\\Name");
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1933
	_LIT(KId, "IAP\\Id");
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1934
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1935
	TInt ret = aRc->GetDesSetting(KName, aApr.iName);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1936
	if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1937
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1938
		ret = aRc->GetIntSetting(KId, aApr.iId);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1939
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1940
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1941
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1942
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1943
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1944
TInt CSocketDesc::StartConnection(void * /* ptr */)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1945
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1946
	if (iConnectionPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1947
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1948
		return KErrAlreadyExists;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1949
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1950
	TCommDbConnPref connPref;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1951
	TInt ret = GetConnectionPreference(connPref);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1952
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1953
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1954
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1955
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1956
	ret = iConnection.Open(*iSockServPtr);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1957
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1958
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1959
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1960
		}	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1961
	ret = iConnection.Start(connPref);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1962
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1963
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1964
		iConnection.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1965
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1966
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1967
	iConnectionPtr = &iConnection;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1968
	ret = ((CFileTable*)iFids)->AddRConnectionPtr(iConnectionPtr, iRConnectionIndex);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1969
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1970
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1971
		iConnection.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1972
		iConnectionPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1973
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1974
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1975
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1976
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1977
TInt CSocketDesc::GetConnectionPreference(TCommDbConnPref &aCommPref)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1978
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1979
	if (iConnPref.iName.Length() == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1980
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1981
		return KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1982
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1983
	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1984
	TAccessPointRecord apr;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1985
	TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1986
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1987
	// Connection preference is set
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1988
		TRAP(ret, GetIapDetailsByNameL(iConnPref.iName, apr));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1989
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1990
	if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1991
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1992
		aCommPref.SetIapId(apr.iId);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1993
		aCommPref.SetNetId(apr.iNetwork);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1994
		aCommPref.SetBearerSet(apr.iBearer);		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1995
		aCommPref.SetDialogPreference((TCommDbDialogPref)apr.iDialogPref);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1996
		aCommPref.SetDirection((TCommDbConnectionDirection)apr.iDirection);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1997
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1998
	return ret;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  1999
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2000
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2001
void CSocketDesc::GetIapDetailsByNameL(
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2002
		TBuf<KCommsDbSvrMaxColumnNameLength> aIapName, 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2003
		TAccessPointRecord &aRecord)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2004
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2005
	TAccessPointRecord tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2006
	CCommsDatabase* iapDatabase;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2007
	CCommsDbTableView* view;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2008
	TInt ret = KErrNotFound;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2009
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2010
	OpenIapTableLC(&iapDatabase, &view);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2011
	ret = view->GotoFirstRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2012
	while (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2013
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2014
		TRAP(ret, ReadRecordFromIapTableL(view, tempRecord));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2015
		if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2016
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2017
			if (aIapName == tempRecord.iName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2018
				{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2019
				aRecord = tempRecord;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2020
				ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2021
				break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2022
				}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2023
			}    	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2024
		ret = view->GotoNextRecord();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2025
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2026
	CleanupStack::PopAndDestroy();// view
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2027
	CleanupStack::PopAndDestroy(iapDatabase);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2028
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2029
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2030
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2031
		User::Leave(KErrNotFound);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2032
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2033
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2034
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2035
void CSocketDesc::StopConnection()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2036
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2037
	iConnection.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2038
	iConnectionPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2039
	((CFileTable*)iFids)->RemoveRConnectionPtrAt(iRConnectionIndex);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2040
	iRConnectionIndex = -1;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2041
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2042
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2043
void CSocketDesc::StopSubConnection()
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2044
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2045
	iSubConnection.Close();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2046
	iSubConnectionPtr = NULL;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2047
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2048
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2049
TInt CSocketDesc::StartSubConnection(void *)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2050
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2051
	if (iSubConnectionPtr != NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2052
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2053
		return KErrAlreadyExists;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2054
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2055
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2056
	TInt ret = KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2057
	TInt rcIndex = 0;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2058
	RConnection *rc;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2059
	TAccessPointRecord record;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2060
	do
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2061
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2062
		if (((CFileTable*)iFids)->RConnectionAt(rcIndex, rc) != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2063
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2064
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2065
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2066
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2067
		// Read index and name of the connection
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2068
		GetRConnectionDetails(rc, record);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2069
		if (record.iName == iConnPref.iName)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2070
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2071
			ret = KErrNone; // RConnection found
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2072
			break;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2073
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2074
		rcIndex++;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2075
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2076
	while (ETrue); //Loop over all active connections
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2077
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2078
	if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2079
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2080
		ret = iSubConnection.Open(*iSockServPtr, RSubConnection::EAttachToDefault, *rc);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2081
		if (ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2082
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2083
			iSubConnectionPtr = &iSubConnection;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2084
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2085
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2086
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2087
	return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2088
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2089
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2090
inline void CSocketDesc::SetFids(void *aFids)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2091
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2092
	iFids = aFids;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2093
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2094
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2095
//Add an entry in the interface routing table	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2096
TInt CSocketDesc::RouteRequest(TInt aReq, void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2097
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2098
	struct rtentry* rt=reinterpret_cast<struct rtentry*>(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2099
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2100
	if (!rt)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2101
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2102
		return KErrArgument;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2103
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2104
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2105
	TInt ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2106
	TPckgBuf<TSoInetRouteInfo>iroute;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2107
	iroute().iType=ERtNormal;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2108
	iroute().iState=ERtReady; 
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2109
	iroute().iMetric=rt->rt_metric;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2110
	if (rt->rt_dev)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2111
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2112
		TPckgBuf<TSoInetInterfaceInfo> iface;		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2113
		TFileName name;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2114
		name.Copy(TPtrC8((TText8*)rt->rt_dev));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2115
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2116
		if((ret=GetInterfaceByName(name, iface)) != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2117
			return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2118
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2119
		Copy(iroute().iIfAddr, iface().iAddress);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2120
		ConvertRtEntry(iroute(), rt);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2121
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2122
		//add the entry
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2123
		ATOMICSOCKETOP( ret = iSocket.SetOpt(aReq, KSolInetRtCtrl, iroute),return KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2124
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2125
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2126
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2127
	return KErrUnknown;				
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2128
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2129
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2130
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2131
TInt CSocketDesc::Copy(TInetAddr& aDest, TInetAddr& aSrc)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2132
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2133
	if (aSrc.IsV4Mapped() || aSrc.IsV4Compat())
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2134
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2135
		aSrc.ConvertToV4();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2136
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2137
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2138
	aDest.SetAddress(aSrc.Address());
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2139
	aDest.SetFamily(aSrc.Family());
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2140
	aDest.SetPort(aSrc.Port());
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2141
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2142
	return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2143
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2144
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2145
TInt CSocketDesc::ConvertSockAddr(TInetAddr& aInetAddr, struct sockaddr_in *aSockAddr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2146
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2147
	if (aSockAddr == NULL)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2148
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2149
		return KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2150
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2151
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2152
		//convert the address and port from network to host byte order...
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2153
		aInetAddr.SetAddress(ByteOrder::Swap32(aSockAddr->sin_addr.s_addr));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2154
		aInetAddr.SetFamily(aSockAddr->sin_family);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2155
		aInetAddr.SetPort(ByteOrder::Swap16(aSockAddr->sin_port));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2156
	return KErrNone;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2157
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2158
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2159
TInt CSocketDesc::ConvertRtEntry(TSoInetRouteInfo& aRouteInfo, struct rtentry *aRouteEntry)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2160
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2161
	if(aRouteEntry == NULL)	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2162
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2163
		return KErrArgument;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2164
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2165
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2166
		ConvertSockAddr(aRouteInfo.iDstAddr, (struct sockaddr_in *)&aRouteEntry->rt_dst);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2167
		ConvertSockAddr(aRouteInfo.iNetMask, (struct sockaddr_in *)&aRouteEntry->rt_genmask);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2168
		ConvertSockAddr(aRouteInfo.iGateway, (struct sockaddr_in *)&aRouteEntry->rt_gateway);			
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2169
	return KErrNone;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2170
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2171
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2172
TInt CSocketDesc::GetInterfaceByName(const TDesC& aIfName, TPckgBuf<TSoInetInterfaceInfo>& aIface)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2173
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2174
	TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2175
	ATOMICSOCKETOP(ret = iSocket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2176
	if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2177
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2178
		return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2179
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2180
	TPckgBuf<TSoInetInterfaceInfo> iface;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2181
	ATOMICSOCKETOP(ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2182
	while(ret == KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2183
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2184
		if (!iface().iAddress.IsUnspecified() && iface().iName.CompareF(aIfName) == 0)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2185
			{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2186
			aIface = iface;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2187
			return ret;    	        
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2188
			}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2189
		ATOMICSOCKETOP( ret = iSocket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, iface), ret = KErrBadHandle )
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2190
		}   	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2191
	return KErrUnknown;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2192
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2193
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2194
TInt CSocketDesc::GetInterfaceHWAddress(void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2195
	{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2196
	ifreq *ifr = reinterpret_cast<ifreq *>(aParam);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2197
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2198
	if (!ifr)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2199
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2200
		return KErrArgument;	
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2201
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2202
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2203
	if (ifr->ifr_name[0] != '\0')
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2204
		{
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2205
        TPckgBuf<TSoInetInterfaceInfo> iface;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2206
        TFileName name;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2207
        ifr->ifr_name[IFNAMSIZ-1] = 0; // don't assume NULL terminated input
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2208
        name.Copy(TPtrC8((TText8*)ifr->ifr_name));
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2209
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2210
        TInt ret = GetInterfaceByName(name, iface); 		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2211
        if (ret != KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2212
            return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2213
    
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2214
        if (iface().iHwAddr.Length() > sizeof(SSockAddr))		
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2215
            {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2216
            Mem::Copy(&(ifr->ifr_hwaddr.sa_data[0]),&(iface().iHwAddr[sizeof(SSockAddr)]), 6);
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2217
            ifr->ifr_hwaddr.sa_family = (TUint16)iface().iHwAddr.Family();
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2218
            ifr->ifr_hwaddr.sa_port = ByteOrder::Swap16(iface().iHwAddr.Port());				
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2219
            return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2220
            }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2221
		}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2222
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2223
	return KErrUnknown;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2224
	}
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2225
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2226
//This function retrieves the Currently active IAP ID using the RSocket Query.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2227
//First get the interface index of the active connection using KSoInterfaceIndex
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2228
//Then with the help of the interface index, fetch the TSoInetIfQuery, under which iZone
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2229
//will contain the snap id. User is supposed to call if_indextoname() api to get the IAP name
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2230
//from the ID retured with this Ioctl implementation.
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2231
TInt CSocketDesc::GetActiveInterface( void *aParam)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2232
    {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2233
    TInt ifindex = -1;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2234
    TInt ret = KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2235
    ATOMICSOCKETOP(ret = iSocket.GetOpt(KSoInterfaceIndex, KSolInetIp , ifindex), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2236
    if(ret!=KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2237
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2238
        return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2239
        }   
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2240
    TPckgBuf<TSoInetIfQuery> opt;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2241
    opt().iIndex = ifindex;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2242
    ATOMICSOCKETOP(ret = iSocket.GetOpt(KSoInetIfQueryByIndex, KSolInetIfQuery, opt), ret = KErrBadHandle)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2243
    if(ret!=KErrNone)
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2244
        {
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2245
        return ret;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2246
        }
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2247
    ifreq *ifr = (ifreq * )aParam;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2248
    ifr->ifr_index  = opt().iZone[1]; //IAP_ID
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2249
    return KErrNone;
37dc158a4522 Start breaking the dependency of backend.dll on bluetooth.dll - commit copies of the original ossrv files from PDK 3.0.2
William Roberts <williamr@symbian.org>
parents:
diff changeset
  2250
    }