-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwrap5cli.h
160 lines (142 loc) · 3.01 KB
/
wrap5cli.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/********************************************************************
prog5ftp.c
Class: CSCI 631 Network Applications Programming
Program: Assignment 5
Author: Vishrant K Gupta
Z-number: z1815637
Date Due: 04/28/17
Purpose: FTP
Execution: Make execute N=5 T=1
*********************************************************************/
#ifndef WRAP5_H_CLI
#define WRAP5_H_CLI
#include "/home/cs631/common/config.h"
#include "/home/cs631/common/in-out.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <stdbool.h>
/* Name: Socket
*
* Prototype:
* int Socket(int family, int type, int protocol)
*
* Description:
* This function is a wrapper for system call socket, it creates an end point for the commnunication.
*
* Header files:
* wrap1cli.h
*/
int Socket(int family, int type, int protocol);
/* Name: Fputs
*
* Prototype:
* int Fputs(const char* recvline, FILE *)
*
* Description:
* Wrapper for fput, it writes string to stream
*
* Header files:
* wrap1cli.h
*/
int Fputs(const char* recvline, FILE *);
/* Name: Inet_pton
*
* Prototype:
* int Inet_pton(int family, const char *strptr, void *addrptr)
*
* Description:
* Wrapper for inet_pton, convert IPv4 and IPv6 addresses from text to binary form
*
* Header files:
* wrap1cli.h
*/
int Inet_pton(int family, const char *strptr, void *addrptr);
/* Name: Connect
*
* Prototype:
* int Connect(int socket_fd, struct sockaddr *serv_addr, int addrlen)
*
* Description:
* Wrapper for Connect, initiate a connection on a socket
*
* Header files:
* wrap1cli.h
*/
int Connect(int socket_fd, struct sockaddr *serv_addr, int addrlen);
/* Name: Close
*
* Prototype:
* int Close(int socket_fd)
*
* Description:
* Wrapper for close, it closes a file descriptor
*
* Header files:
* wrap1cli.h
*/
int Close(int socket_fd);
/*
* Name: Writen
*
* Prototype:
* ssize_t Writen(int, void*, size_t)
*
* Description:
* write data to socket
*
* Header files:
* wrap1cli.h
*
*/
ssize_t Writen(int, const void*, size_t);
/*
* Name: Readline
*
* Prototype:
* ssize_t Readline(int, void*, size_t)
*
* Description:
* Read data from socket
*
* Header files:
* wrap1cli.h
*
*/
ssize_t Readline(int, void*, size_t);
/*
* Name: Fgets
*
* Prototype:
* char* Fgets(char *s, int size, FILE *stream)
*
* Description:
* Read data from stream
*
* Header files:
* wrap1cli.h
*
*/
char* Fgets(char *s, int size, FILE *stream);
/*
* Name: Chdir
*
* Prototype:
* int Chdir(const char *path)
*
* Description:
* change dir
*
* Header files:
* wrap1cli.h
*
*/
int Chdir(const char *path);
#endif