natfw/natfwstunturnclient/inc/ttransactioncleanup.h
changeset 0 1bce908db942
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/natfw/natfwstunturnclient/inc/ttransactioncleanup.h	Tue Feb 02 01:04:58 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:    
+*
+*/
+
+
+
+
+#ifndef C_TRANSACTIONCLEANUP_H
+#define C_TRANSACTIONCLEANUP_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CSTUNTransaction;
+
+// CLASS DECLARATION
+/**
+ * This class is used to terminate the STUN transaction, if a leave occurs
+ * while the transaction was processing a received STUN message.
+ */
+class TTransactionCleanup
+    {
+public: // Constructor
+
+    /**
+     * Constructor
+     *
+     * @param aTransaction STUN transaction, that will be terminated.
+     */
+    TTransactionCleanup( CSTUNTransaction& aTransaction );
+
+public: // New functions
+
+    /**
+     * Returns a TCleanupItem which can be pushed into CleanupStack.
+     *
+     * @return TCleanupItem
+     */
+    TCleanupItem CleanupItem();
+
+    /**
+     * When CleanupStack destroys the TCleanupItem, this function is called.
+     * The iTransaction is terminated.
+     *
+     * @pre aCleanup != NULL
+     *
+     * @param aCleanup Pointer to a TTransactionCleanup. Ownership is not
+     *          transferred.
+     */
+    static void TerminateTransaction( TAny* aCleanup );
+
+private: // Data
+
+    CSTUNTransaction& iTransaction;
+    };
+
+#endif // C_TRANSACTIONCLEANUP_H