"Fossies" - the Fresh Open Source Software Archive

Member "httperf-0.9.0/src/object.h" (7 Apr 2007, 2902 Bytes) of package /linux/www/old/httperf-0.9.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "object.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2     httperf -- a tool for measuring web server performance
    3     Copyright 2000-2007 Hewlett-Packard Company and Contributors listed in
    4     AUTHORS file. Originally contributed by David Mosberger-Tang
    5 
    6     This file is part of httperf, a web server performance measurment
    7     tool.
    8 
    9     This program is free software; you can redistribute it and/or
   10     modify it under the terms of the GNU General Public License as
   11     published by the Free Software Foundation; either version 2 of the
   12     License, or (at your option) any later version.
   13     
   14     In addition, as a special exception, the copyright holders give
   15     permission to link the code of this work with the OpenSSL project's
   16     "OpenSSL" library (or with modified versions of it that use the same
   17     license as the "OpenSSL" library), and distribute linked combinations
   18     including the two.  You must obey the GNU General Public License in
   19     all respects for all of the code used other than "OpenSSL".  If you
   20     modify this file, you may extend this exception to your version of the
   21     file, but you are not obligated to do so.  If you do not wish to do
   22     so, delete this exception statement from your version.
   23 
   24     This program is distributed in the hope that it will be useful,
   25     but WITHOUT ANY WARRANTY; without even the implied warranty of
   26     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   27     General Public License for more details.
   28 
   29     You should have received a copy of the GNU General Public License
   30     along with this program; if not, write to the Free Software
   31     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
   32     02110-1301, USA
   33 */
   34 #ifndef object_h
   35 #define object_h
   36 
   37 #ifdef DEBUG
   38 # define object_is_conn(o)  (((Object *) (o))->type == OBJ_CONN)
   39 # define object_is_call(o)  (((Object *) (o))->type == OBJ_CALL)
   40 # define object_is_sess(o)  (((Object *) (o))->type == OBJ_SESS)
   41 #else
   42 # define object_is_conn(o)  1
   43 # define object_is_call(o)  1
   44 # define object_is_sess(o)  1
   45 #endif
   46 
   47 typedef enum Object_Type
   48   {
   49     OBJ_CONN,           /* connection object */
   50     OBJ_CALL,           /* call object */
   51     OBJ_SESS,           /* session object */
   52     OBJ_NUM_TYPES
   53   }
   54 Object_Type;
   55 
   56 typedef struct Object
   57   {
   58     Object_Type type;
   59     u_int ref_count;            /* # of references to this object */
   60   }
   61 Object;
   62 
   63 /* This may be called during httperf initialize to reserve SIZE
   64    "private" bytes in objects of type TYPE.  The return value is the
   65    offset of the private area.  */
   66 
   67 extern size_t object_expand (Object_Type type, size_t size);
   68 
   69 /* Create a new object of type TYPE.  */
   70 extern Object *object_new (Object_Type type);
   71 
   72 /* Create a new reference for object OBJ.  */
   73 #define object_inc_ref(o)   (++(o)->ref_count)
   74 
   75 /* Decrement the reference for object OBJ.  If the reference count
   76    reaches zero, the object's destroy function is called.  */
   77 extern void object_dec_ref (Object *obj);
   78 
   79 #endif /* object_h */