The dpheader man page
NAME
dp - the header file dp.h
DESCRIPTION
Unorthodox though it may be, here is the dp.h file that
should be included in all dp programs (dp users access this
by including in their code):
/* file: dp.h */
/*
* header file to the low-level dp library.
*
* copyright (c) 1992 D. Arnow and Brooklyn College
*
*/
#include
/* SEND MODES FOLLOW */
#define DPRECV 0x00 /* peer can get this msg via dprecv */
/* peer's catching function will not be */
/* invoked */
#define DPGETMSG 0x01 /* peer can get this msg via dpgetmsg */
/* peer's catching function (if set */
/* with dpcatchmsg) will be invoked. */
#define DPREL 0x00 /* guaranteed delivery of msg to peer */
/* dp level */
#define DPUNREL 0x02 /* good luck: no guarantee of delivery.*/
/* RECV FLAGS FOLLOW */
#define DPBLOCK 0x00 /* Wait until message arrives */
#define DPNOBLOCK 0x01 /* Don't wait */
/* RETURN CODES FOLLOW */
#define DPSUCCESS 0
#define DPFAIL (-1)
#define DPNOMESSAGE (-2)
#define DPDESTDEAD (-3)
struct dpdstr {
char *dpd_data; /* point to message data */
int dpd_len; /* # bytes of " " */
struct dpdstr *dpd_next; /* next node in message */
};
typedef struct dpdstr DPDNODE;
struct dphost_tag { /* host info available to the app. */
char h_host[128];
char h_domain[128];
char h_name[256]; /* name of machine */
int h_avail; /* est. avail slots */
};
typedef struct dphost_tag DPHOST;
#define DPIDSIZE 28
typedef char DPID[DPIDSIZE]; /* the identification of a dp process*/
typedef char *DPIDP;
typedef void (*FUNCPTR)();
#define NULLFUNC ((FUNCPTR) 0)
int dpinit(); /* dpinit(char *prog, char **semanticp, int *size, *hostid) */
/* STORES BACK: pointer to semantic packet */
/* STORES BACK: size of semantic packet */
/* STORES BACK: my integer host id */
/* RETURNS: DPFAIL or # of available hosts */
int dpaddhost(); /* dpaddhost(char *hstn, *dmnn, *path, *user, *paswd)*/
/* RETURNS: number of hosts in host table */
void dpgethost(); /* dpgethost(int hid, DPHOST *hptr); */
/* STORES BACK: host info for host #hid */
int dpsend(); /* dpsend(DPID *dest, DPDNODE *data, int mode) */
/* RETURNS: DPSUCCESS or DPFAIL or DPDESTDEAD */
int dpwrite(); /* dpsend(DPID *dest, char *data, int nbytes, mode)*/
/* RETURNS: DPSUCESS or DPFAIL or DPDESTDEAD */
int dprecv(); /* dprecv(DPID *src, char *data, int limit, flags)*/
/* RETURNS: DPSUCCESS or DPFAIL or DPNOMESSAGE */
int dpgetmsg(); /* dpgetmsg(DPID *src, char *data, int limit)*/
/* RETURNS: DPSUCCESS or DPFAIL or DPNOMESSAGE */
void dpexit(); /* dpexit(char *exitstrng) */
void dpgetpid();/* dpgetpid(DPID *myid) */
/* STORES BACK: dp process id of executing process */
void dpcall(); /* dpcall(long t, FUNCPTR f) */
/* set alarm for user's function f */
void dppause(); /* dppause(long t, FUNCPTR f) */
/* set alarm for user's function f and pause */
int dpblock(); /* disable interrupts */
void dpunblock();/* enable interrupts */
int dpspawn(); /* dpspawn(char *prog, DPID *newid, int hid, */
/* char *semantic, int size, sendflag) */
/* spawn a process prog on host #hid, giving it the */
/* semantic packet indicated; STORES BACK the id of */
/* the new process and returns DPSUCCESS or DPFAIL */
int dpinvite(); /* dpinvite(char *path, *semantic, int size) */
/* set up invitation for processes to become DPized */
/* RETURNS: DPSUCCESS OR DPFAIL */
int dpjoin(); /* dpjoin(char *path, *semantic, int *semsize, *hostid)*/
/* join up as a DP process */
/* STORES BACK: my integer host id */
/* RETURNS: number of hosts in my host table */
FUNCPTR dpcatchmsg(); /* dpcatchmsg(FUNCPTR f) */
/* RETURNS NULLFUNC or pointer to previous */
/* catching function */
void dpsetexfun(); /* dpsetexfun(FUNCPTR f) */
/* set a function to be called when exiting */
void dpstop(); /* dpstop(char *stopmsg) */
void dphtonid(); /* dphtonid(DPID *nid, *hid) */
/* converts host byte-ordered hid to network */
/* byte order and store it in nid */
void dpntohid(); /* dpntohid(DPID *hid, *nid) */
/* converts network byte-ordered nid to host */
/* byte order and store it in hid */
int dpidmatch(); /* dpidmatch(DPID id1, DPID id2) */
/* returns true if id1 and id2 are equal */
/* returns false otherwise */
#define dontohl(n) (long) ntohl((u_long) (n)) /* signed #s */
#define dohtonl(n) (long) htonl((u_long) (n))
#define dontohs(n) (short) ntohs((u_short) (n))
#define dohtons(n) (short) htons((u_short) (n))
#define dohtoni(n) ( (int) ( (sizeof(int) == sizeof(short))? dohtons(n):dohtonl(n)))
#define dontohi(n) ( (int) ( (sizeof(int) == sizeof(short))? dontohs(n):dontohl(n)))
AUTHOR
David Arnow
Essential DP MAN Pages:
General/Essential:
Non-Interrupting Messages:
Interrupting Messages:
dpblock
dpcatchmsg
dpgetmsg
dppause
dpunblock
Other:
Return to
DP For Students
Return to
The DP Project
Return to
David Arnow's Home Page