Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _CHAT_H_
- #define _CHAT_H_
- #define SERVER_MESSAGE_TYPE 65536
- #define SHM_SIZE 65536 /* 4KB */
- int shm_id;
- int msg_id;
- void *shm_addr;
- void *cur_addr;
- /*
- * Pointer starts at beginning of shared memory region,
- * then advances every time a new message is written until
- * it reaches the end, at which point it starts over at the
- * beginning, overwriting the oldest entries.
- */
- struct message {
- long mtype; /* Holds the client's PID */
- char mtext[4096];
- };
- /*
- * The mtype for messages sent from server to clients needs
- * to encode both the client's PID and the fact that it's a
- * message to the client rather than from the client. To do
- * this, I will have it be 65536 plus the PID of the client.
- */
- __BEGIN_DECLS
- void deamonize( void );
- void initialize_user_list( void );
- void create_shared_memory( void );
- void create_message_queue( void );
- void poll( void );
- void server_process( struct message * );
- void broadcast( char * );
- void adduser( long );
- void deluser( long );
- void say( struct message * );
- void echo( char *, long );
- void write_memory( struct message * );
- void memwrite( char * );
- void signals( void );
- void stop( int );
- void cont( int );
- void quit( int );
- void client_process( int );
- void setup_user( void );
- void register_shared_memory( void );
- void register_message_queue( void );
- void enter_raw_mode( void );
- void input_loop( void );
- void exit_raw_mode( void );
- void mwrite( struct message * );
- void kick( void );
- void update_ptr( void );
- void mread( void );
- char *memread( void );
- __END_DECLS
- #endif
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement