Overview of Files and Subroutines
Here follows a list of the program files and their contents. The list is given
here only to provide a minimal overview of the code written. Excerpts from the
server program, pserver.c
, and the include file for client applications,
pclient.h
, are given in Appendix A. An overview of which
files are included in which files can be seen in Figure 6.5.
pclient.h: Include file for client
applications.6.2
- #include: "pesto.h" & "ppclient.h"
- contains all of those primitives described in Section 5.7.1
and Section 5.7.2 except p_perror.
Figure 6.5:
Include files
 |
ptacod.c: Communication between




and TACO. It is in
this file that the intervals for connected, weakly connected, and disconnected
operation are defined (see Figure 6.1, p.
).
- #include: "pesto.h" & "mobsup.h"
- #define: FULL_COST_MAX,
FULL_BANDWIDTH_MIN, FULL_LATENCY_MAX,
WEAK_COST_MAX, WEAK_BANDWIDTH_MIN &
WEAK_LATENCY_MAX.
Should be linked with the TACO mob library:
cc -o ptacod -I/home/projects/tacoo/tacosys/moblib/include \
-L/home/projects/tacoo/tacosys/moblib/lib -D LINUX ptacod.c \
-lmob
Is supposed to run on client machine in the background, and
the TACO link daemon, linkd, should also be running.
--
pserver.c:




server program.
- #include: "pesto.h" & "ppserver.h"
- void main(int argc,char *argv[])
- void p_server()
Is supposed to be running on the server machine!
--
pesto.h: Shared include file for clients and server.
- p_perror (see 5.7.2)
- int init_host(char *host,int port,struct sockaddr_in *sa)
- int init_sock(struct sockaddr_in *sa,int *sd)
- int send_file(int sd,char *name)
- int recv_file(int sd,char *name,mode_t perms)
- int close_sock(int sd)
- int lock_file(int fd)
- int unlock_file(int fd)
Also contains all necessary includes of standard libraries, all
commonly used defines, a type definition of the buffer used for exchanging
messages between server and client, and global variables (such as the




error number variable int pso_errno).
--
ppclient.h: Include file for client code. Contains
miscellaneous help functions used by the various library functions in
pclient.h
.
- #include: "pinfo.h", "ptaco.h" &
"pname.h"
- typedef: NAME & _nameb
- void pbuf(pmessage *buf,int request,long ret,long wet,long
ct,long cct,long mt,char *name)
- FILE *pfopen(char *name,char *mode,int fd)
- int prequest(struct sockaddr_in *sa,int *sd,pmessage *buf)
- int preceive(struct sockaddr_in *sa,int *sd,pmessage *buf)
--
pinfo.h: Include file for client code. Contains functions
that read, write, and update caching information for files.
- void name_info(char *name,char *infoname)
- int write_info(int fd,long mt,long ct,long cct,long ret,long
wet,long crt)
- int read_info(char *name,long *mt,long *ct,long *cct,long
*ret,long *wet,long *crt,int *fd)
- int update_info(int fd,long mt,long ct,long cct,long ret,long
wet,long crt)
- int delete_info(char *name)
--
ptaco.h: Include file for client code. Contains the
function int ptaco() used for determining communication status as
reported by ptacod.c
.
--
pname.h: Include file for client code. Contains functions
for mapping file pointer to file names and lock expiration times. Uses the
NAME
& _nameb
structures defined in ppclient.h
in a
similar manner to the handling of open file pointers in [21, Ch.8].
- int pgetname(FILE *fp,char *name)
- int pinsname(FILE *fp,char *name)
- int pdelname(FILE *fp)
--
ppserver.h: Include file for server code. Contains
miscellaneous help functions used in the server program.
- #include: "plock.h"
- #define: LOG & LOGFILE
- void plog(char *str)
- void plogerr(char *str,int sd,char *name)
--
plock.h: Include file for server code. Contains functions
that read, write, and update locking information for files.
- name_lock(char *name,char *lockname)
- int write_lock(int fd,char *host,long ret,long wet)
- int read_lock(char *name,char *host,long *ret,long *wet,int *fd)
- int update_lock(int fd,char *host,int ret,int wet)
- int lookup_lock(int fd,char *host,long ret,long wet)
- int delete_lock(char *name)
Footnotes
- ...
applications.6.2
- Will some day be implemented as a library.
michael@garfield.dk
2000-10-13