146 lines
3.9 KiB
C
146 lines
3.9 KiB
C
/******************************************************************************
|
|
*
|
|
* (c) Copyright 1998, University of Karlstad.
|
|
*
|
|
* 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:
|
|
*
|
|
* student.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, 08, 1998
|
|
*
|
|
* DESCRIPTION:
|
|
*
|
|
* Includes header files, declaring the functions that are available
|
|
* and can be used in the Data Communication I course programming project.
|
|
*
|
|
* NOTE:
|
|
*
|
|
* If any system header files needs to be included in the same module as this
|
|
* file is included, make sure they are included before this file or otherwise
|
|
* it might not be possible to compile due to type redeclaration errors.
|
|
*
|
|
* MODIFICATIONS: Date Changes
|
|
* ----------------------------------------------------------------------------
|
|
*
|
|
* 1998-03-16 Added the function FindAction.
|
|
*
|
|
*/
|
|
|
|
#ifndef _STUDENT_H /* Avoid multiple copies of this file. */
|
|
#define _STUDENT_H
|
|
|
|
#ifdef __cplusplus /* Make this file possible to include in C++ code. */
|
|
extern "C" {
|
|
#endif
|
|
|
|
/******************************************************************************
|
|
* INCLUDE FILES
|
|
*/
|
|
|
|
#include "systems.h"
|
|
#include "udefs.h"
|
|
#include "sockets.h"
|
|
#include "socketio.h"
|
|
#include "unixsockets.h"
|
|
#include "uselect.h"
|
|
#include "utimer.h"
|
|
|
|
/******************************************************************************
|
|
*
|
|
* sockets.h:
|
|
*
|
|
* int AcceptConnection(int sockfd)
|
|
*
|
|
* socketio.h:
|
|
*
|
|
* int WriteSignaltoSocket(int sockfd, unsigned int signal, \
|
|
* unsigned int siglen)
|
|
* int ReadSignalfromSocket(int sockfd, unsigned int siglen)
|
|
* int WriteDatatoSocket(int sockfd, char* databuf, unsigned int datalen)
|
|
* int ReadDatafromSocket(int sockfd, char* databuf, unsigned int datalen)
|
|
*
|
|
* unixsockets.h:
|
|
*
|
|
* int CreateUnixClientSocket(char *path)
|
|
* int CreateUnixServerSocket(char *path)
|
|
*
|
|
* uselect.h:
|
|
*
|
|
* struct timeval *SetPollTimeout(int seconds, int microseconds)
|
|
* int PollSocket(int sockfd1, int sockfd2, struct timeval *tv)
|
|
*
|
|
* utimer.h:
|
|
*
|
|
* void SetTimer(unsigned int seconds)
|
|
* void ResetTimer(void)
|
|
* int SetTimeoutHandler(void (*handler)(int))
|
|
*
|
|
*/
|
|
|
|
/******************************************************************************
|
|
* DEFINE TYPES
|
|
*/
|
|
|
|
/* Pointer to a function that takes nothing and returns an int. */
|
|
typedef int (*psf) __P((void));
|
|
|
|
/* Struct defining the relationship between a signal and a function. */
|
|
typedef struct action{
|
|
int signal;
|
|
psf function;
|
|
} action;
|
|
|
|
/******************************************************************************
|
|
* DECLARE FUNCTIONS
|
|
*/
|
|
|
|
/* See function definitions for documentation. */
|
|
|
|
extern psf FindAction __P((int signal, const__ action *list));
|
|
|
|
/******************************************************************************
|
|
* END
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _STUDENT_H */
|
|
|