mux/src/file_c.h File Reference

#include "copyright.h"
#include "interface.h"

Include dependency graph for file_c.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FC_CONN   0
#define FC_CONN_SITE   1
#define FC_CONN_DOWN   2
#define FC_CONN_FULL   3
#define FC_CONN_GUEST   4
#define FC_CONN_REG   5
#define FC_CREA_NEW   6
#define FC_CREA_REG   7
#define FC_MOTD   8
#define FC_WIZMOTD   9
#define FC_QUIT   10
#define FC_LAST   10

Functions

void fcache_rawdump (SOCKET fd, int num)
void fcache_dump (DESC *d, int num)
void fcache_send (dbref, int)
void fcache_load (dbref)
void fcache_init (void)


Define Documentation

#define FC_CONN   0

Definition at line 14 of file file_c.h.

Referenced by welcome_user().

#define FC_CONN_DOWN   2

Definition at line 16 of file file_c.h.

Referenced by check_connect().

#define FC_CONN_FULL   3

Definition at line 17 of file file_c.h.

Referenced by check_connect().

#define FC_CONN_GUEST   4

Definition at line 18 of file file_c.h.

Referenced by check_connect(), and do_motd().

#define FC_CONN_REG   5

Definition at line 19 of file file_c.h.

Referenced by check_connect(), and welcome_user().

#define FC_CONN_SITE   1

Definition at line 15 of file file_c.h.

Referenced by check_connect(), and new_connection().

#define FC_CREA_NEW   6

Definition at line 20 of file file_c.h.

Referenced by check_connect().

#define FC_CREA_REG   7

Definition at line 21 of file file_c.h.

Referenced by check_connect().

#define FC_LAST   10

Definition at line 25 of file file_c.h.

Referenced by fcache_dump(), and fcache_rawdump().

#define FC_MOTD   8

Definition at line 22 of file file_c.h.

Referenced by check_connect(), and do_motd().

#define FC_QUIT   10

Definition at line 24 of file file_c.h.

Referenced by shutdownsock().

#define FC_WIZMOTD   9

Definition at line 23 of file file_c.h.

Referenced by check_connect(), and do_motd().


Function Documentation

void fcache_dump ( DESC d,
int  num 
)

Definition at line 212 of file file_c.cpp.

References filecache_block::data, FC_LAST, fcache, filecache_hdr::fileblock, filecache_block::hdr, filecache_block::filecache_block_hdr::nchars, filecache_block::filecache_block_hdr::nxt, and queue_write_LEN().

Referenced by check_connect(), failconn(), fcache_send(), shutdownsock(), and welcome_user().

00213 {
00214     if ((num < 0) || (num > FC_LAST))
00215     {
00216         return;
00217     }
00218     FBLOCK *fp = fcache[num].fileblock;
00219 
00220     while (fp != NULL)
00221     {
00222         queue_write_LEN(d, fp->data, fp->hdr.nchars);
00223         fp = fp->hdr.nxt;
00224     }
00225 }

void fcache_init ( void   ) 

Definition at line 274 of file file_c.cpp.

References fcache, fcache_load(), filecache_hdr::fileblock, NOTHING, and filecache_hdr::ppFilename.

Referenced by main().

00275 {
00276     FCACHE *fp = fcache;
00277     for (fp = fcache; fp->ppFilename; fp++)
00278     {
00279         fp->fileblock = NULL;
00280     }
00281 
00282     fcache_load(NOTHING);
00283 }

void fcache_load ( dbref   ) 

Definition at line 237 of file file_c.cpp.

References alloc_lbuf, alloc_sbuf, filecache_hdr::desc, fcache, fcache_read(), filecache_hdr::fileblock, free_lbuf, free_sbuf, mux_ltoa(), NOTHING, notify, filecache_hdr::ppFilename, Quiet, and safe_str.

Referenced by do_readcache(), and fcache_init().

00238 {
00239     FCACHE *fp;
00240     char *buff, *bufc, *sbuf;
00241 
00242     buff = bufc = alloc_lbuf("fcache_load.lbuf");
00243     sbuf = alloc_sbuf("fcache_load.sbuf");
00244     for (fp = fcache; fp->ppFilename; fp++)
00245     {
00246         int i = fcache_read(&fp->fileblock, *fp->ppFilename);
00247         if (  player != NOTHING
00248            && !Quiet(player))
00249         {
00250             mux_ltoa(i, sbuf);
00251             if (fp == fcache)
00252             {
00253                 safe_str("File sizes: ", buff, &bufc);
00254             }
00255             else
00256             {
00257                 safe_str("  ", buff, &bufc);
00258             }
00259             safe_str(fp->desc, buff, &bufc);
00260             safe_str("...", buff, &bufc);
00261             safe_str(sbuf, buff, &bufc);
00262         }
00263     }
00264     *bufc = '\0';
00265     if (  player != NOTHING
00266        && !Quiet(player))
00267     {
00268         notify(player, buff);
00269     }
00270     free_lbuf(buff);
00271     free_sbuf(sbuf);
00272 }

void fcache_rawdump ( SOCKET  fd,
int  num 
)

Definition at line 182 of file file_c.cpp.

References cnt, filecache_block::data, FC_LAST, fcache, filecache_hdr::fileblock, filecache_block::hdr, filecache_block::filecache_block_hdr::nchars, filecache_block::filecache_block_hdr::nxt, and SOCKET_WRITE.

Referenced by new_connection().

00183 {
00184     if ((num < 0) || (num > FC_LAST))
00185     {
00186         return;
00187     }
00188 
00189     FBLOCK *fp = fcache[num].fileblock;
00190     int cnt, remaining;
00191     char *start;
00192 
00193     while (fp != NULL)
00194     {
00195         start = fp->data;
00196         remaining = fp->hdr.nchars;
00197         while (remaining > 0)
00198         {
00199             cnt = SOCKET_WRITE(fd, start, remaining, 0);
00200             if (cnt < 0)
00201             {
00202                 return;
00203             }
00204             remaining -= cnt;
00205             start += cnt;
00206         }
00207         fp = fp->hdr.nxt;
00208     }
00209     return;
00210 }

void fcache_send ( dbref  ,
int   
)

Definition at line 227 of file file_c.cpp.

References DESC_ITER_PLAYER, and fcache_dump().

Referenced by do_list_file(), and do_motd().

00228 {
00229     DESC *d;
00230 
00231     DESC_ITER_PLAYER(player, d)
00232     {
00233         fcache_dump(d, num);
00234     }
00235 }


Generated on Mon May 28 04:40:16 2007 for MUX by  doxygen 1.4.7