prog.c:15:16: error: field 'hdr' has incomplete type
struct tcphdr hdr;
^
prog.c:27:21: warning: 'struct addrinfo' declared inside parameter list
int tcp_scan(struct addrinfo *addr);
^
prog.c:27:21: warning: its scope is only this definition or declaration, which is probably not what you want
prog.c: In function 'main':
prog.c:32:18: error: storage size of 'hints' isn't known
struct addrinfo hints;
^
prog.c:46:16: warning: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration]
ret_getaddr = getaddrinfo(argv[1], NULL, &hints, &result);
^
prog.c:48:40: warning: implicit declaration of function 'gai_strerror' [-Wimplicit-function-declaration]
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret_getaddr));
^
prog.c:48:19: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Wformat=]
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret_getaddr));
^
prog.c:52:56: error: dereferencing pointer to incomplete type 'struct addrinfo'
for (struct addrinfo *rp = result; rp != NULL; rp = rp->ai_next) {
^
prog.c:53:12: warning: passing argument 1 of 'tcp_scan' from incompatible pointer type [-Wincompatible-pointer-types]
tcp_scan(rp);
^
prog.c:27:5: note: expected 'struct addrinfo *' but argument is of type 'struct addrinfo *'
int tcp_scan(struct addrinfo *addr);
^
prog.c:32:18: warning: unused variable 'hints' [-Wunused-variable]
struct addrinfo hints;
^
prog.c: At top level:
prog.c:76:21: warning: 'struct addrinfo' declared inside parameter list
int tcp_scan(struct addrinfo *addr) {
^
prog.c:76:5: error: conflicting types for 'tcp_scan'
int tcp_scan(struct addrinfo *addr) {
^
prog.c:27:5: note: previous declaration of 'tcp_scan' was here
int tcp_scan(struct addrinfo *addr);
^
prog.c: In function 'tcp_scan':
prog.c:88:27: error: invalid application of 'sizeof' to incomplete type 'struct tcphdr'
pckt.hdr.th_off = sizeof(struct tcphdr) / 4;
^
prog.c:107:55: error: dereferencing pointer to incomplete type 'struct addrinfo'
ret_send = sendto(tcp_socket, &pckt, pcktlen, 0, addr->ai_addr, addr->ai_addrlen);
^
prog.c:80:20: warning: unused variable 'ret_recv' [-Wunused-variable]
ssize_t ret_send, ret_recv;
^