LCOV - code coverage report
Current view: directory - objdir/dist/include - nsASocketHandler.h (source / functions) Found Hit Coverage
Test: app.info Lines: 3 3 100.0 %
Date: 2012-06-02 Functions: 1 1 100.0 %

       1                 : /* ***** BEGIN LICENSE BLOCK *****
       2                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       3                 :  *
       4                 :  * The contents of this file are subject to the Mozilla Public License Version
       5                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       6                 :  * the License. You may obtain a copy of the License at
       7                 :  * http://www.mozilla.org/MPL/
       8                 :  *
       9                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      10                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11                 :  * for the specific language governing rights and limitations under the
      12                 :  * License.
      13                 :  *
      14                 :  * The Original Code is Mozilla.
      15                 :  *
      16                 :  * The Initial Developer of the Original Code is
      17                 :  * Netscape Communications Corporation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2002
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Darin Fisher <darin@netscape.com>
      23                 :  *   Florian Queze <florian@queze.net>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef nsASocketHandler_h__
      40                 : #define nsASocketHandler_h__
      41                 : 
      42                 : // socket handler used by nsISocketTransportService.
      43                 : // methods are only called on the socket thread.
      44                 : 
      45                 : class nsASocketHandler : public nsISupports
      46                 : {
      47                 : public:
      48            6304 :     nsASocketHandler()
      49                 :         : mCondition(NS_OK)
      50                 :         , mPollFlags(0)
      51            6304 :         , mPollTimeout(PR_UINT16_MAX)
      52            6304 :         {}
      53                 : 
      54                 :     //
      55                 :     // this condition variable will be checked to determine if the socket
      56                 :     // handler should be detached.  it must only be accessed on the socket
      57                 :     // thread.
      58                 :     //
      59                 :     nsresult mCondition;
      60                 : 
      61                 :     //
      62                 :     // these flags can only be modified on the socket transport thread.
      63                 :     // the socket transport service will check these flags before calling
      64                 :     // PR_Poll.
      65                 :     //
      66                 :     PRUint16 mPollFlags;
      67                 : 
      68                 :     //
      69                 :     // this value specifies the maximum amount of time in seconds that may be
      70                 :     // spent waiting for activity on this socket.  if this timeout is reached,
      71                 :     // then OnSocketReady will be called with outFlags = -1.
      72                 :     //
      73                 :     // the default value for this member is PR_UINT16_MAX, which disables the
      74                 :     // timeout error checking.  (i.e., a timeout value of PR_UINT16_MAX is
      75                 :     // never reached.)
      76                 :     //
      77                 :     PRUint16 mPollTimeout;
      78                 : 
      79                 :     //
      80                 :     // called to service a socket
      81                 :     // 
      82                 :     // params:
      83                 :     //   socketRef - socket identifier
      84                 :     //   fd        - socket file descriptor
      85                 :     //   outFlags  - value of PR_PollDesc::out_flags after PR_Poll returns
      86                 :     //               or -1 if a timeout occurred
      87                 :     //
      88                 :     virtual void OnSocketReady(PRFileDesc *fd, PRInt16 outFlags) = 0;
      89                 : 
      90                 :     //
      91                 :     // called when a socket is no longer under the control of the socket
      92                 :     // transport service.  the socket handler may close the socket at this
      93                 :     // point.  after this call returns, the handler will no longer be owned
      94                 :     // by the socket transport service.
      95                 :     //
      96                 :     virtual void OnSocketDetached(PRFileDesc *fd) = 0;
      97                 : };
      98                 : 
      99                 : #endif // !nsASocketHandler_h__

Generated by: LCOV version 1.7