-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathftutil.h
51 lines (41 loc) · 1.04 KB
/
ftutil.h
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
41
42
43
44
45
46
47
48
49
50
51
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Program: ftutil.h
* Author: Nathan Cochran
* Date: 11/17/2013
* Description: Header file for ftutil.c
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#ifndef FTUTIL_H
#define FTUTIL_H
//CONSTANTS:
#define PROTOCOL 0
#define CONTROL_PORT 30021
#define CONTROL_PORT_STR "30021"
#define DATA_PORT 30020
#define BACKLOG 5
#define BUF_SIZE 256
#define FILE_BUF_SIZE 4096
#define PROMPT ">>"
//COMMAND TYPE IDENTIFIERS:
#define INVALID -1
#define EXIT 0
#define LIST 1
#define GET 2
#define CD 3
#define PWD 4
//FUNCTION PROTOTYPES:
void send_message(int socket_fd, char *message);
int create_socket(void);
void bind_socket(int socket_fd, unsigned short port);
void listen_socket(int socket_fd);
int accept_connection(int socket_fd);
int parse_command(char * buffer, char * arg);
int input_yn(char * prompt);
#endif