104 lines
2.8 KiB
C
104 lines
2.8 KiB
C
/******************************************************************************
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 1, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
* Please report any bugs you find in this code or any improvements to:
|
|
*
|
|
* Hans Hedbom, Dept. of Computer Science,
|
|
* University of Karlstad, Sweden.
|
|
*
|
|
* Phone: +46 54 838157
|
|
* E-mail: Hans.Hedbom@hks.se
|
|
*
|
|
* ============================================================================
|
|
*
|
|
* FILE:
|
|
*
|
|
* uselect.h [ the Data Communication I course programming project ]
|
|
*
|
|
* AUTHORS:
|
|
*
|
|
* Jonny Wiederholm
|
|
* E-mail: fr7wied@cse.hks.se or
|
|
* jonnwied@hks.se
|
|
*
|
|
* Per-Ola Gustafsson
|
|
* E-mail: fr7gust@cse.hks.se
|
|
*
|
|
* CREATION DATE:
|
|
*
|
|
* Jan, 06, 1998
|
|
*
|
|
* DESCRIPTION:
|
|
*
|
|
* Includes types and declarations of functions needed to poll sockets in the
|
|
* example implementation of the Data Communication I course programming
|
|
* project.
|
|
*
|
|
* MODIFICATIONS: Date Changes
|
|
* ----------------------------------------------------------------------------
|
|
*
|
|
*/
|
|
|
|
#ifndef _USELECT_H /* Avoid multiple copies of this file. */
|
|
#define _USELECT_H
|
|
|
|
#ifdef __cplusplus /* Make this file possible to use in C++ code. */
|
|
extern "C" {
|
|
#endif
|
|
|
|
/******************************************************************************
|
|
* INCLUDE FILES
|
|
*/
|
|
|
|
#include "systems.h"
|
|
|
|
/******************************************************************************
|
|
* DEFINE TYPES
|
|
*/
|
|
|
|
/* Type representing part of a time peroid. */
|
|
#if defined (__linux__) || defined (_AIX)
|
|
typedef int time_p_;
|
|
#elif defined(sun)
|
|
typedef long time_p_;
|
|
#endif /* defined (__linux__) || defined (_AIX) */
|
|
|
|
/* Structure representing a timeout time period. */
|
|
struct timeout {
|
|
time_p_ tv_sec; /* Seconds. */
|
|
time_p_ tv_usec; /* Microseconds. */
|
|
};
|
|
|
|
/******************************************************************************
|
|
* DECLARE FUNCTIONS
|
|
*/
|
|
|
|
/* See function definitions for documentation. */
|
|
|
|
extern struct timeout *SetPollTimeout __P((time_p_ seconds, time_p_ \
|
|
microseconds));
|
|
extern int PollSocket __P((int sockfd1, int sockfd2, struct timeout *to));
|
|
|
|
/******************************************************************************
|
|
* END
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _USELECT_H */
|