return (NULL);
}
-size_t send_message (const interface_t *iface, const dhcp_t *dhcp,
- unsigned long xid, char type,
- const options_t *options)
+ssize_t send_message (const interface_t *iface, const dhcp_t *dhcp,
+ unsigned long xid, char type,
+ const options_t *options)
{
struct udp_dhcp_packet *packet;
dhcpmessage_t *message;
uint32_t ul;
uint16_t sz;
unsigned int message_length;
- size_t retval;
+ ssize_t retval;
if (!iface || !options || !dhcp)
return -1;
return (head);
}
+
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message)
{
const unsigned char *p = message->options;
dhcpmessage_t dhcp;
};
-size_t send_message (const interface_t *iface, const dhcp_t *dhcp,
- unsigned long xid, char type,
- const options_t *options);
+ssize_t send_message (const interface_t *iface, const dhcp_t *dhcp,
+ unsigned long xid, char type,
+ const options_t *options);
void free_dhcp (dhcp_t *dhcp);
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message);
struct msghdr msg;
static unsigned int seq;
char *buffer;
- int bytes;
+ ssize_t bytes;
union
{
char *buffer;
return fd;
}
-int send_packet (const interface_t *iface, int type,
- const unsigned char *data, int len)
+ssize_t send_packet (const interface_t *iface, int type,
+ const unsigned char *data, int len)
{
- int retval = -1;
+ ssize_t retval = -1;
struct iovec iov[2];
if (iface->family == ARPHRD_ETHER) {
/* BPF requires that we read the entire buffer.
So we pass the buffer in the API so we can loop on >1 dhcp packet. */
-int get_packet (const interface_t *iface, unsigned char *data,
- unsigned char *buffer, int *buffer_len, int *buffer_pos)
+ssize_t get_packet (const interface_t *iface, unsigned char *data,
+ unsigned char *buffer, int *buffer_len, int *buffer_pos)
{
union
{
bpf.buffer += *buffer_pos;
while (bpf.packet) {
- int len = -1;
+ ssize_t len = -1;
union
{
unsigned char *buffer;
return fd;
}
-int send_packet (const interface_t *iface, const int type,
- const unsigned char *data, const int len)
+ssize_t send_packet (const interface_t *iface, const int type,
+ const unsigned char *data, const int len)
{
union sockunion {
struct sockaddr sa;
struct sockaddr_ll sll;
struct sockaddr_storage ss;
} su;
- int retval;
+ ssize_t retval;
if (! iface)
return -1;
/* Linux has no need for the buffer as we can read as much as we want.
We only have the buffer listed to keep the same API. */
-int get_packet (const interface_t *iface, unsigned char *data,
- unsigned char *buffer, int *buffer_len, int *buffer_pos)
+ssize_t get_packet (const interface_t *iface, unsigned char *data,
+ unsigned char *buffer, int *buffer_len, int *buffer_pos)
{
- long bytes;
+ ssize_t bytes;
union
{
unsigned char *buffer;
struct in_addr source, struct in_addr dest);
int open_socket (interface_t *iface, bool arp);
-int send_packet (const interface_t *iface, int type,
- const unsigned char *data, int len);
-int get_packet (const interface_t *iface, unsigned char *data,
- unsigned char *buffer, int *buffer_len, int *buffer_pos);
+ssize_t send_packet (const interface_t *iface, int type,
+ const unsigned char *data, int len);
+ssize_t get_packet (const interface_t *iface, unsigned char *data,
+ unsigned char *buffer, int *buffer_len, int *buffer_pos);
#endif