vpnengine/ikesocket/inc/ikedatainterface.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  IKE socket data interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_IKEDATAINTERFACE_H
       
    20 #define M_IKEDATAINTERFACE_H
       
    21 
       
    22 #include <in_sock.h>
       
    23 
       
    24 /**
       
    25  *  IKE socket data transfer interface.
       
    26  *
       
    27  *  This interface defines functionality for sending and receiving UDP data.
       
    28  *
       
    29  *  After client has started receiving, data is queued to receive queue. Queud
       
    30  *  data will be cleared, when clients stops receiving, or connection has been
       
    31  *  disconnected.
       
    32  *
       
    33  *  @lib ikesocket.lib
       
    34  */
       
    35 class MIkeDataInterface
       
    36     {    
       
    37 public:
       
    38     
       
    39     /**
       
    40      * Sends UDP data.
       
    41      *
       
    42      * @param aLocalPort Local port
       
    43      * @param aDestAddr Destination IP address/port
       
    44      * @param aUdpData UDP data
       
    45      * @param aDscp DSCP value
       
    46      * @param aStatus Completion status (returned)
       
    47      *                -KErrArgument if local port is neither 500 or 4500, and
       
    48      *                              destination port does not equal local port
       
    49      *                              (equal when Nokia NAT keepalive packet
       
    50      *                              sent)
       
    51      *                -KErrDisconnected if connection is disconnected                                
       
    52      */
       
    53     virtual void SendUdpData( const TInt aLocalPort,
       
    54                               const TInetAddr& aDestAddr,
       
    55                               const TDesC8& aUdpData,
       
    56                               const TUint aDscp,
       
    57                               TRequestStatus& aStatus ) = 0;
       
    58     
       
    59     /**
       
    60      * Cancels sending.
       
    61      */
       
    62     virtual void CancelSend() = 0;
       
    63     
       
    64     /**
       
    65      * Starts to receive UDP data. Completes when data is available or error
       
    66      * has occured. 
       
    67      *
       
    68      * @param aUdpData Received UDP data (returned)
       
    69      * @param aSrcAddr Source IP address/port (returned)
       
    70      * @param aLocalPort Local port (returned)
       
    71      * @param aStatus Completion status (returned)
       
    72      *                  -KErrDisconnected if connection is disconnected
       
    73      */
       
    74     virtual void ReceiveUdpData( HBufC8*& aUdpData,
       
    75                                  TInetAddr& aSrcAddr,
       
    76                                  TInt& aLocalPort,
       
    77                                  TRequestStatus& aStatus  ) = 0;
       
    78     
       
    79     /**
       
    80      * Cancels receive request.
       
    81      */
       
    82     virtual void CancelReceive() = 0;
       
    83 
       
    84     /**
       
    85      * Clears data which has been received.
       
    86      */
       
    87     virtual void ClearReceivedData() = 0;
       
    88     
       
    89     /**
       
    90      * Stops receiving. Clears data which has been received.
       
    91      */
       
    92     virtual void StopReceive() = 0;
       
    93     
       
    94     /**
       
    95      * Gets local IP address of interface.
       
    96      *
       
    97      * @param aLocalIp Local IP address (returned)
       
    98      * @return Error status. KErrNotFound if address is not found.
       
    99      */
       
   100     virtual TInt GetLocalAddress( TInetAddr& aLocalIp ) = 0;
       
   101     };
       
   102 
       
   103 
       
   104 #endif // M_IKEDATAINTERFACE_H