-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclientCode.h
More file actions
40 lines (34 loc) · 1013 Bytes
/
clientCode.h
File metadata and controls
40 lines (34 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CLIENTCODE_H
#define CLIENTCODE_H
#include "shared.h"
#include <stdio.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <pthread.h>
//Socket variables
extern char rbuf[BUFLEN];
extern char username[USERNAMELEN];
extern int port, sd, icon;
//Thread variables
extern pthread_t thread;
extern int threadID;
//Callback declerations
typedef void (*clientCodeCallback)(char * message);
extern clientCodeCallback recvMessage;
extern clientCodeCallback newUser;
extern clientCodeCallback leftUser;
//Function definitions
void connectToServer(char * serverIP, clientCodeCallback recvCallback, clientCodeCallback newClientCallback, clientCodeCallback leftClientCallback, char * user, int ico) ;
void sendMessage(char * message);
char * receiveMessage();
void closeConnection();
void * receiveThread(void * ptr);
#endif //CLIENTCODE_H