cs.h revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* connect stream interface definitions
*/
#ifndef _CS_H
#define _CS_H
#define CS_VERSION 19970717L
#include <ast.h>
#include <ast_cs.h>
#include <hashpart.h>
#include <ls.h>
#include <times.h>
#define CS_NORMAL CS_PORT_NORMAL
#define CS_RESERVED CS_PORT_RESERVED
#define CS_REMOTE_CONTROL "cs"
#define CS_REMOTE_DEBUG 'd'
#define CS_REMOTE_DELAY 8
#define CS_REMOTE_OPEN 'O'
#define CS_REMOTE_OPEN_AGENT 'A'
#define CS_REMOTE_OPEN_LOCAL 'L'
#define CS_REMOTE_OPEN_NOW 'N'
#define CS_REMOTE_OPEN_READ 'R'
#define CS_REMOTE_OPEN_SHARE 'S'
#define CS_REMOTE_OPEN_TEST 'T'
#define CS_REMOTE_OPEN_TRUST 'X'
#define CS_REMOTE_PROFILE "set true; $1 eval 'unset true eval; source ./.login >& /dev/null < /dev/null'; set eval CsH=true; $1 $CsH 'shift; shift; . ./.profile >/dev/null 2>&1 </dev/null'"
#define CS_OPEN_READ 0 /* initiate and open for read */
#define CS_VAR_LOCAL 0 /* csvar for local mount dir */
/*
* cs.flags -- CS_<function>_<flags>
*/
typedef struct
{
} Csaddr_t;
typedef struct
{
unsigned long hid; /* host id */
unsigned long pid; /* process id */
unsigned long uid; /* user id */
unsigned long gid; /* group id */
} Csid_t;
typedef struct
{
unsigned long idle; /* min user idle secs */
long up; /* up (down<0) time in secs */
int load; /* load average */
int pctsys; /* % time for sys */
int pctusr; /* % time for usr */
int users; /* # interesting users */
} Csstat_t;
struct Cs_s;
struct Csdisc_s;
struct Csdisc_s /* user discipline */
{
unsigned long version; /* CS_VERSION */
unsigned long flags; /* CS_* flags */
};
struct Cs_s /* thread state */
{
char* id; /* library id */
unsigned long addr; /* addr from csbind() */
unsigned long port; /* port from csbind() */
unsigned long time; /* time updated by CSTIME() */
unsigned long flags; /* misc flags */
char* control; /* CS_MNT_* in cs.mount */
char* cs; /* service connect stream */
#ifdef _CS_PRIVATE_
#endif
};
#if _BLD_cs && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if !_BLD_cs && defined(__IMPORT__)
#define extern extern __IMPORT__
#endif
#undef extern
#if _BLD_cs && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if CS_INTERFACE <= 1
#define csattach _cs_attach
#define csclient _cs_client
#define cschallenge _cs_challenge
#define csdaemon _cs_daemon
#define cstimeout _cs_timeout
#define cswakeup _cs_wakeup
#else
extern int cschallenge(Cs_t*, const char*, unsigned long*, unsigned long*);
extern void csserve(Cs_t*, void*, const char*, void*(*)(void*, int), int(*)(void*, int), int(*)(void*, int, Csid_t*, int, char**), int(*)(void*, int), int(*)(void*, int), int(*)(void*));
#endif
extern unsigned long _cs_addr(const char*);
extern int _cs_attach(const char*, int, int);
extern char* _cs_attr(const char*, const char*);
extern int _cs_auth(int, const char*, const char*);
extern int _cs_bind(const char*, unsigned long, unsigned long, unsigned long);
extern int _cs_client(int, const char*, const char*, char**, unsigned int);
extern unsigned long _cs_clone(int);
extern int _cs_daemon(int);
extern int _cs_fd(int, int);
extern char* _cs_full(unsigned long);
extern int _cs_local(const char*);
extern char* _cs_name(unsigned long);
extern char* _cs_ntoa(unsigned long);
extern int _cs_open(const char*, int);
extern char* _cs_path(int, int);
extern int _cs_ping(const char*);
extern int _cs_pipe(int*);
extern unsigned long _cs_port(const char*, const char*);
extern int _cs_send(int, int*, int);
extern void _cs_serve(void*, const char*, void*(*)(void*, int), int(*)(void*, int), int(*)(void*, int, Csid_t*, int, char**), int(*)(void*, int), int(*)(void*, int), int(*)(void*));
extern unsigned long _cs_timeout(unsigned long);
extern char* _cs_var(int, int);
extern unsigned long _cs_wakeup(unsigned long);
#endif
#undef extern
#endif