Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

networkpeer.cpp

Go to the documentation of this file.
00001 /*
00002  * networkpeer.cpp,v 1.9 2003/11/25 19:29:56 mattid Exp
00003  *
00004  * COBAIN - Communications API for EPOC Environments
00005  * Copyright (C) 2002-2003 Matti Dahlbom, Matti Kokkola
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * Contact: Matti Dahlbom <matti@777-team.org>
00022  *          Matti Kokkola <matti.kokkola@iki.fi>
00023  */
00024 
00025 #include "cobain.h"
00026 #include "clientsession.h"
00027 #include "clientservercommon.h"
00028 
00029 CNetworkPeer* CNetworkPeer::NewL(RCobainClientSession &aSession,
00030                                   TProtocol aProtocol,
00031                                   TDesC &aDeviceName, 
00032                                   TDesC8 &aDeviceAddress, 
00033                                   TDesC8 &aServiceID,
00034                                   TUint aPort)
00035 {
00036     CNetworkPeer *c = new CNetworkPeer(aSession, aProtocol, aPort);
00037     CleanupStack::PushL(c);
00038     c->ConstructL(aDeviceName, aDeviceAddress, aServiceID);
00039     CleanupStack::Pop();  // c
00040 
00041     return c;
00042 }
00043 
00044 void CNetworkPeer::ConstructL(TDesC &aDeviceName, 
00045                               TDesC8 &aDeviceAddress, 
00046                               TDesC8 &aServiceID)
00047 {
00048     iDeviceName = aDeviceName.AllocL();
00049     iDeviceAddress = aDeviceAddress.AllocL();
00050     iServiceID = aServiceID.AllocL();
00051 }
00052 
00053 CNetworkPeer::CNetworkPeer(RCobainClientSession &aSession,
00054                            TProtocol aProtocol,
00055                            TUint aPort)
00056     : iSession(aSession),
00057       iProtocol(aProtocol),
00058       iPort(aPort)
00059 {
00060 }
00061 
00062 //
00063 // public methods
00064 // 
00065 
00066 EXPORT_C CNetworkPeer::~CNetworkPeer()
00067 {
00068     delete iDeviceName;
00069     delete iDeviceAddress;
00070     delete iServiceID;
00071 }
00072 
00073 EXPORT_C RCobainSocket* CNetworkPeer::ConnectL()
00074 {
00075     return iSession.ConnectSocketL(this);
00076 }

Generated on Mon Dec 8 10:26:07 2003 for CobainAPIImplementation by doxygen 1.3.5