/home/hillier_g/checkout/most4linux/libnetservices/src/linux/global.h

00001 /*
00002  *  Copyright(c) Siemens AG, Muenchen, Germany, 2005, 2006, 2007
00003  *                           Bernhard Walle <bernhard.walle@gmx.de>
00004  *                           Gernot Hillier <gernot.hillier@siemens.com>
00005  *                           All rights reserved.
00006  *
00007  * ----------------------------------------------------------------------------
00008  * The contents of this file are subject to the Mozilla Public License
00009  * Version 1.1 (the "License"); you may not use this file except in
00010  * compliance with the License. You may obtain a copy of the License at
00011  * http://www.mozilla.org/MPL/
00012  * 
00013  * Software distributed under the License is distributed on an "AS IS"
00014  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
00015  * License for the specific language governing rights and limitations
00016  * under the License.
00017  *
00018  * The Original Code is Siemens code.
00019  * 
00020  * The Initial Developer of the Original Code is Siemens AG.
00021  * Portions created by the Initial Developer are Copyright (C) 2005-06
00022  * the Initial Developer. All Rights Reserved.
00023  * ----------------------------------------------------------------------------
00024  */
00025 #ifndef GLOBAL_H
00026 #define GLOBAL_H
00027 
00028 #include <stdio.h>
00029 #include <pthread.h>
00030 #include <time.h>
00031 #include <sys/time.h>
00032 
00033 #include "debug.h"
00034 
00038 extern int g_control_fd;
00039 
00042 extern pthread_mutex_t g_nets_mutex;
00043 
00051 #define CHECK_FILEDESCRIPTOR_RET()                                              \
00052     do {                                                                        \
00053         if (g_control_fd == 0) {                                                \
00054             PRINT_DBG("File descriptor invalid. Library was not initalized");   \
00055             return;                                                             \
00056         }                                                                       \
00057     } while (FALSE)
00058 
00070 #define CHECK_FILEDESCRIPTOR_RET_VAL(val)                                       \
00071     do {                                                                        \
00072         if (g_control_fd == 0) {                                                \
00073             PRINT_DBG("File descriptor invalid. Library was not initalized");   \
00074             return val;                                                         \
00075         }                                                                       \
00076     } while (FALSE)
00077 
00078 
00084 #define TIME_IN_MS(time)                                                        \
00085     do {                                                                        \
00086         struct timeval tmp;                                                     \
00087         gettimeofday(&tmp, NULL);                                               \
00088         time = (unsigned long long)tmp.tv_sec * 1000 + tmp.tv_usec / 1000;      \
00089     } while(0);
00090 
00091 
00092 
00093 #endif /* GLOBAL_H */
00094 
00095 /* vim: set ts=4 et sw=4: */

Generated on Fri Mar 9 14:48:59 2007 for MOST Adaption Layer for Netservices Library by  doxygen 1.5.0