voipplugins/dhcppositionprovider/inc/dhcpsocketlistener.h
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DHCPSOCKETLISTENER_H
       
    20 #define DHCPSOCKETLISTENER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <in_sock.h>
       
    24 
       
    25 #include "dhcpdataresponsepacket.h"
       
    26 
       
    27 /**
       
    28 *  Listen receiving DHCP socket messages
       
    29 *
       
    30 *  @lib dhcppositionprovider
       
    31 *  @since S60 3.2
       
    32 */
       
    33 class CDhcpPsySocketListener : public CActive
       
    34     {
       
    35     public:
       
    36         /**
       
    37          * Two-phased statical constructor which can leave
       
    38          *
       
    39          * @since S60 3.2
       
    40          */
       
    41         static CDhcpPsySocketListener* NewL( RSocket* aSocket );
       
    42 
       
    43         /**
       
    44          * Default destructor.
       
    45          *
       
    46          * @since S60 3.2
       
    47          */
       
    48         virtual ~CDhcpPsySocketListener();
       
    49 
       
    50     public:
       
    51 
       
    52         /**
       
    53          * Set this active object to waiting for UDP messages
       
    54          *
       
    55          * @since S60 3.0
       
    56          * @return None
       
    57          */
       
    58         void RcvDHCPMessage (TRequestStatus& aStatus);
       
    59 
       
    60         /**
       
    61          * Set this active object to waiting for UDP messages from
       
    62          * connectionless socket
       
    63          *
       
    64          * @since S60 3.0
       
    65          * @return None
       
    66          */
       
    67         void RcvDHCPMessageConnectionlessL (TRequestStatus& aStatus);
       
    68 
       
    69         /*
       
    70         * Set transaction to follow.
       
    71         *
       
    72         */
       
    73         void SetTransActionIdToFollow (TUint32 aXid);
       
    74 
       
    75     public:
       
    76 
       
    77         /*
       
    78         * Return location civic data for caller.
       
    79         *
       
    80         */
       
    81         const TDesC8&   LocationCivicInformation ();
       
    82 
       
    83         /*
       
    84         * Return location geographical information for caller
       
    85         *
       
    86         */
       
    87         const TDesC8&   GeoConfigDhcpInformation ();
       
    88 
       
    89     protected:
       
    90 
       
    91         /**
       
    92          * Cancellation of an outstanding request.
       
    93          */
       
    94          void DoCancel();
       
    95 
       
    96          /**
       
    97          * Handles an active object's request completion event.
       
    98          */
       
    99          void RunL();
       
   100 
       
   101     private:
       
   102 
       
   103         /*
       
   104          * 2nd phase Symbian style constructor which can leave.
       
   105         */
       
   106         void ConstructL();
       
   107 
       
   108         /**
       
   109          * C++ constructor
       
   110          *
       
   111          * @since S60 3.2
       
   112          */
       
   113         CDhcpPsySocketListener (RSocket* aSocket);
       
   114 
       
   115         /**
       
   116         * Check received message that was the message to request.
       
   117         * Checking is made by transaction id.
       
   118         */
       
   119         TBool CheckAckXid ();
       
   120 
       
   121     public:     // for timeout control
       
   122 
       
   123         /**
       
   124         * Called by static periodic timer callback
       
   125         */
       
   126         void CancelOutstandigRequest ();
       
   127 
       
   128     private:    // for timeout control
       
   129 
       
   130         /**
       
   131          * Activete timeout control for this object
       
   132          */
       
   133         void StartTimer ();
       
   134 
       
   135         /*
       
   136          * The callback function for CPeriodic.
       
   137          * param aAny A pointer to this object.
       
   138          */
       
   139          static TInt PeriodicTimerCallBack(TAny* aAny);
       
   140 
       
   141     private: // data
       
   142 
       
   143         /**
       
   144          * Received DHCP ACK package
       
   145          */
       
   146         TDhcpDataResponsePacket iAckPckg;
       
   147 
       
   148         /**
       
   149          * Socket
       
   150          * Not own.
       
   151          */
       
   152         RSocket* iSocket;
       
   153 
       
   154         /**
       
   155          * Filled in with amount of data sent before completion
       
   156          */
       
   157         TSockXfrLength iLen;
       
   158 
       
   159         /**
       
   160          * Address used if using connectionless socket
       
   161          */
       
   162         TInetAddr iAddress;
       
   163 
       
   164         /**
       
   165          * Flag indicating connectionlessness
       
   166          */
       
   167         TBool iIsConnectionless;
       
   168 
       
   169         // Received data buffer
       
   170         TPtr8 iRcvdDataBuffer;
       
   171 
       
   172         // Received data buffer.
       
   173         HBufC8* iRcvdDataHeapBufferPtr;
       
   174 
       
   175         // Transaction to be follow.
       
   176         TUint32 iXid;
       
   177 
       
   178         //
       
   179         TRequestStatus* iClientStatus;
       
   180 
       
   181         // To cancel outstanding request if needed.
       
   182         CPeriodic*  iPeriodicTimer;
       
   183 
       
   184     };
       
   185 
       
   186 #endif // DHCPSOCKETLISTENER_H
       
   187 
       
   188