query_util.h 815 Bytes
//
//  query_util.h
//  BBAAPIRequest_Sdt
//
//  Created by chenjia09 on 2019/9/21.
//

#if defined __APPLE__
#ifndef query_util_h
#define query_util_h
#include <sys/socket.h>
#include "socket_address.h"

#define MAXBUFSIZE      4096

static const int IP_HEADER_LEN = 20;
static const int ICMP_HEADER_LEN = 8;

char* Sock_ntop_host(const struct sockaddr* sa, socklen_t salen);

void Gettimeofday(struct timeval* tv, void* foo);

int Sendto(int fd, const void* ptr, size_t nbytes, int flags, const struct sockaddr* sa, socklen_t salen);

struct addrinfo* Host_serv(const char* host, const char* serv, int family, int socktype);

int Socket(int family, int type, int protocol);

uint16_t in_cksum(uint16_t* _addr, int _len);

void tv_sub(struct timeval* _out, struct timeval* _in);

#endif
#endif /* query_utils_h */