prog.c:15:16: error: field 'hdr' has incomplete type
struct tcphdr hdr;
^
prog.c:19:21: warning: 'struct addrinfo' declared inside parameter list
int tcp_scan(struct addrinfo *addr);
^
prog.c:19:21: warning: its scope is only this definition or declaration, which is probably not what you want
prog.c: In function 'main':
prog.c:24:18: error: storage size of 'hints' isn't known
struct addrinfo hints;
^
prog.c:38:16: warning: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration]
ret_getaddr = getaddrinfo(argv[1], NULL, &hints, &result);
^
prog.c:40:40: warning: implicit declaration of function 'gai_strerror' [-Wimplicit-function-declaration]
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret_getaddr));
^
prog.c:40: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:44:56: error: dereferencing pointer to incomplete type 'struct addrinfo'
for (struct addrinfo *rp = result; rp != NULL; rp = rp->ai_next) {
^
prog.c:45:12: warning: passing argument 1 of 'tcp_scan' from incompatible pointer type [-Wincompatible-pointer-types]
tcp_scan(rp);
^
prog.c:19:5: note: expected 'struct addrinfo *' but argument is of type 'struct addrinfo *'
int tcp_scan(struct addrinfo *addr);
^
prog.c:24:18: warning: unused variable 'hints' [-Wunused-variable]
struct addrinfo hints;
^
prog.c: At top level:
prog.c:68:21: warning: 'struct addrinfo' declared inside parameter list
int tcp_scan(struct addrinfo *addr) {
^
prog.c:68:5: error: conflicting types for 'tcp_scan'
int tcp_scan(struct addrinfo *addr) {
^
prog.c:19:5: note: previous declaration of 'tcp_scan' was here
int tcp_scan(struct addrinfo *addr);
^
prog.c: In function 'tcp_scan':
prog.c:79:27: error: invalid application of 'sizeof' to incomplete type 'struct tcphdr'
pckt.hdr.th_off = sizeof(struct tcphdr) / 4;
^
prog.c:92: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:72:20: warning: unused variable 'ret_recv' [-Wunused-variable]
ssize_t ret_send, ret_recv;
^