mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-26 23:16:05 +03:00
Added packet_init
This commit is contained in:
parent
3c7d3c6a35
commit
3748056240
11
src/packet.c
11
src/packet.c
@ -67,6 +67,17 @@ packet_fill(struct packet *packet, char *data, unsigned long datalen)
|
|||||||
return packet->len;
|
return packet->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear packet stuct, mark empty
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
packet_init(struct packet *packet)
|
||||||
|
{
|
||||||
|
packet->sentlen = 0;
|
||||||
|
packet->offset = 0;
|
||||||
|
packet->len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark len number of bytes as being sent
|
* Mark len number of bytes as being sent
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +27,7 @@ struct packet
|
|||||||
char data[PKTSIZE]; /* The data */
|
char data[PKTSIZE]; /* The data */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void packet_init(struct packet *);
|
||||||
int packet_sending(struct packet *);
|
int packet_sending(struct packet *);
|
||||||
void packet_advance(struct packet *);
|
void packet_advance(struct packet *);
|
||||||
int packet_len_to_send(struct packet *);
|
int packet_len_to_send(struct packet *);
|
||||||
|
@ -46,9 +46,8 @@ init_users(in_addr_t my_ip)
|
|||||||
users[i].id = i;
|
users[i].id = i;
|
||||||
snprintf(newip, sizeof(newip), "0.0.0.%d", i + 1);
|
snprintf(newip, sizeof(newip), "0.0.0.%d", i + 1);
|
||||||
users[i].tun_ip = my_ip + inet_addr(newip);;
|
users[i].tun_ip = my_ip + inet_addr(newip);;
|
||||||
users[i].inpacket.len = 0;
|
packet_init(&(users[i].inpacket));
|
||||||
users[i].inpacket.offset = 0;
|
packet_init(&(users[i].outpacket));
|
||||||
users[i].outpacket.len = 0;
|
|
||||||
users[i].q.id = 0;
|
users[i].q.id = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user