void-packages/srcpkgs/pptpclient/patches/musl.patch
2015-09-14 20:59:46 +02:00

671 lines
30 KiB
Diff

diff --git ppp_fcs.c ppp_fcs.c
index 8822691..70ae09b 100644
--- ppp_fcs.c
+++ ppp_fcs.c
@@ -27,7 +27,7 @@
* u16 represents an unsigned 16-bit number. Adjust the typedef for
* your hardware.
*/
-typedef u_int16_t u16;
+typedef uint16_t u16;
/*
* FCS lookup table as calculated by the table generator.
diff --git ppp_fcs.h ppp_fcs.h
index dc1891c..5cb9ed7 100644
--- ppp_fcs.h
+++ ppp_fcs.h
@@ -5,8 +5,9 @@
*/
#include "pptp_compat.h"
+#include <stdint.h>
#define PPPINITFCS16 0xffff /* Initial FCS value */
#define PPPGOODFCS16 0xf0b8 /* Good final FCS value */
-u_int16_t pppfcs16(u_int16_t fcs, void *cp, int len);
+uint16_t pppfcs16(uint16_t fcs, void *cp, int len);
diff --git pptp.c pptp.c
index 8995e30..c20ab65 100644
--- pptp.c
+++ pptp.c
@@ -22,6 +22,7 @@
*/
#include <sys/types.h>
+#include <stdint.h>
#include <sys/socket.h>
#if defined(__FreeBSD__)
#include <libutil.h>
@@ -84,7 +85,7 @@ struct in_addr get_ip_address(char *name);
int open_callmgr(struct in_addr inetaddr, char *phonenr, int argc,char **argv,char **envp, int pty_fd, int gre_fd);
void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc,char **argv,char **envp);
int get_call_id(int sock, pid_t gre, pid_t pppd,
- u_int16_t *call_id, u_int16_t *peer_call_id);
+ uint16_t *call_id, uint16_t *peer_call_id);
void launch_pppd(char *ttydev, int argc, char **argv);
/*** print usage and exit *****************************************************/
@@ -192,7 +193,7 @@ int main(int argc, char **argv, char **envp)
char *tty_name;
int pty_fd, tty_fd, gre_fd, rc;
volatile pid_t parent_pid, child_pid;
- u_int16_t call_id, peer_call_id;
+ uint16_t call_id, peer_call_id;
char buf[128];
int pppdargc;
char **pppdargv;
@@ -530,9 +531,9 @@ void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc __attribute
/*** exchange data with the call manager *************************************/
/* XXX need better error checking XXX */
int get_call_id(int sock, pid_t gre, pid_t pppd,
- u_int16_t *call_id, u_int16_t *peer_call_id)
+ uint16_t *call_id, uint16_t *peer_call_id)
{
- u_int16_t m_call_id, m_peer_call_id;
+ uint16_t m_call_id, m_peer_call_id;
/* write pid's to socket */
/* don't bother with network byte order, because pid's are meaningless
* outside the local host.
diff --git pptp_callmgr.c pptp_callmgr.c
index 0bdfb93..0ca47b8 100644
--- pptp_callmgr.c
+++ pptp_callmgr.c
@@ -7,6 +7,7 @@
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <stdint.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -65,7 +66,7 @@ void call_callback(PPTP_CONN *conn, PPTP_CALL *call, enum call_state state)
{
struct local_callinfo *lci;
struct local_conninfo *conninfo;
- u_int16_t call_id[2];
+ uint16_t call_id[2];
switch(state) {
case CALL_OPEN_DONE:
/* okey dokey. This means that the call_id and peer_call_id are
diff --git pptp_compat.h pptp_compat.h
index ab1517a..27b0b7a 100644
--- pptp_compat.h
+++ pptp_compat.h
@@ -5,9 +5,9 @@
#if defined (__SVR4) && defined (__sun) /* Solaris */
#include <sys/termios.h>
-#define u_int8_t uint8_t
-#define u_int16_t uint16_t
-#define u_int32_t uint32_t
+#define uint8_t uint8_t
+#define uint16_t uint16_t
+#define uint32_t uint32_t
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffffU
diff --git pptp_ctrl.c pptp_ctrl.c
index 9864374..69d82b0 100644
--- pptp_ctrl.c
+++ pptp_ctrl.c
@@ -11,6 +11,7 @@
#endif /* Solaris */
#include <sys/time.h>
#include <sys/types.h>
+#include <stdint.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
@@ -73,14 +74,14 @@ struct PPTP_CONN {
KA_NONE, KA_OUTSTANDING
} ka_state; /* on startup: KA_NONE */
/* Keep-alive ID; monotonically increasing (watch wrap-around!) */
- u_int32_t ka_id; /* on startup: 1 */
+ uint32_t ka_id; /* on startup: 1 */
/* Other properties. */
- u_int16_t version;
- u_int16_t firmware_rev;
- u_int8_t hostname[64], vendor[64];
+ uint16_t version;
+ uint16_t firmware_rev;
+ uint8_t hostname[64], vendor[64];
/* XXX these are only PNS properties, currently XXX */
/* Call assignment information. */
- u_int16_t call_serial_number;
+ uint16_t call_serial_number;
VECTOR *call;
void * closure;
pptp_conn_cb callback;
@@ -103,9 +104,9 @@ struct PPTP_CALL {
PNS_IDLE, PNS_WAIT_REPLY, PNS_ESTABLISHED, PNS_WAIT_DISCONNECT
} pns;
} state;
- u_int16_t call_id, peer_call_id;
- u_int16_t sernum;
- u_int32_t speed;
+ uint16_t call_id, peer_call_id;
+ uint16_t sernum;
+ uint32_t speed;
/* For user data: */
pptp_call_cb callback;
void * closure;
@@ -197,7 +198,7 @@ int ctrlp_disp(PPTP_CONN * conn, void * buffer, size_t size);
void pptp_set_link(PPTP_CONN * conn, int peer_call_id);
/*** log error information in control packets *********************************/
-static void ctrlp_error( int result, u_int8_t error, int cause,
+static void ctrlp_error( int result, uint8_t error, int cause,
const char *result_text[], int max_result)
{
if( cause >= 0)
@@ -353,7 +354,7 @@ PPTP_CALL * pptp_call_open(PPTP_CONN * conn, pptp_call_cb callback,
/* Initialize call structure */
call->call_type = PPTP_CALL_PNS;
call->state.pns = PNS_IDLE;
- call->call_id = (u_int16_t) i;
+ call->call_id = (uint16_t) i;
call->sernum = conn->call_serial_number++;
call->callback = callback;
call->closure = NULL;
@@ -420,7 +421,7 @@ void pptp_call_destroy(PPTP_CONN *conn, PPTP_CALL *call)
}
/*** this is a soft close *****************************************************/
-void pptp_conn_close(PPTP_CONN * conn, u_int8_t close_reason)
+void pptp_conn_close(PPTP_CONN * conn, uint8_t close_reason)
{
struct pptp_stop_ctrl_conn rqst = {
PPTP_HEADER_CTRL(PPTP_STOP_CTRL_CONN_RQST),
@@ -703,7 +704,7 @@ static void logecho( int type)
int ctrlp_disp(PPTP_CONN * conn, void * buffer, size_t size)
{
struct pptp_header *header = (struct pptp_header *)buffer;
- u_int8_t close_reason = PPTP_STOP_NONE;
+ uint8_t close_reason = PPTP_STOP_NONE;
assert(conn && conn->call); assert(buffer);
assert(ntoh32(header->magic) == PPTP_MAGIC);
assert(ntoh16(header->length) == size);
@@ -873,7 +874,7 @@ int ctrlp_disp(PPTP_CONN * conn, void * buffer, size_t size)
struct pptp_out_call_rply *packet =
(struct pptp_out_call_rply *)buffer;
PPTP_CALL * call;
- u_int16_t callid = ntoh16(packet->call_id_peer);
+ uint16_t callid = ntoh16(packet->call_id_peer);
log("Received Outgoing Call Reply.");
if (!vector_search(conn->call, (int) callid, &call)) {
log("PPTP_OUT_CALL_RPLY received for non-existant call: "
@@ -946,8 +947,8 @@ int ctrlp_disp(PPTP_CONN * conn, void * buffer, size_t size)
struct pptp_call_clear_ntfy *packet =
(struct pptp_call_clear_ntfy *)buffer;
int i;
- u_int16_t our_call_id;
- u_int16_t peer_call_id = ntoh16(packet->call_id);
+ uint16_t our_call_id;
+ uint16_t peer_call_id = ntoh16(packet->call_id);
log("Call disconnect notification received (call id %d)",
(int) peer_call_id);
/* See if we can map the peer's call id to our own */
@@ -1018,7 +1019,7 @@ void pptp_set_link(PPTP_CONN* conn, int peer_call_id)
/*** Get info from call structure *********************************************/
/* NOTE: The peer_call_id is undefined until we get a server response. */
void pptp_call_get_ids(PPTP_CONN * conn, PPTP_CALL * call,
- u_int16_t * call_id, u_int16_t * peer_call_id)
+ uint16_t * call_id, uint16_t * peer_call_id)
{
assert(conn != NULL); assert(call != NULL);
*call_id = call->call_id;
diff --git pptp_ctrl.h pptp_ctrl.h
index 9020443..a2f728a 100644
--- pptp_ctrl.h
+++ pptp_ctrl.h
@@ -7,6 +7,7 @@
#ifndef INC_PPTP_CTRL_H
#define INC_PPTP_CTRL_H
#include <sys/types.h>
+#include <stdint.h>
#include "pptp_compat.h"
typedef struct PPTP_CONN PPTP_CONN;
@@ -36,7 +37,7 @@ void pptp_call_destroy(PPTP_CONN *conn, PPTP_CALL *call);
int pptp_conn_is_dead(PPTP_CONN * conn);
void pptp_conn_free(PPTP_CONN * conn);
/* soft close. Will callback on completion. */
-void pptp_conn_close(PPTP_CONN * conn, u_int8_t close_reason);
+void pptp_conn_close(PPTP_CONN * conn, uint8_t close_reason);
/* hard close */
void pptp_conn_destroy(PPTP_CONN * conn);
@@ -47,7 +48,7 @@ int pptp_dispatch(PPTP_CONN * conn, fd_set * read_set, fd_set * write_set);
/* Get info about connection, call */
void pptp_call_get_ids(PPTP_CONN * conn, PPTP_CALL * call,
- u_int16_t * call_id, u_int16_t * peer_call_id);
+ uint16_t * call_id, uint16_t * peer_call_id);
/* Arbitrary user data about this call/connection.
* It is the caller's responsibility to free this data before calling
* pptp_call|conn_close()
diff --git pptp_gre.c pptp_gre.c
index 6d1e288..c6e7c11 100644
--- pptp_gre.c
+++ pptp_gre.c
@@ -6,6 +6,7 @@
*/
#include <sys/types.h>
+#include <stdint.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
@@ -36,9 +37,9 @@ extern int rtmark;
((((curseq) & 0xffffff00) == 0) && \
(((lastseq) & 0xffffff00 ) == 0xffffff00))
-static u_int32_t ack_sent, ack_recv;
-static u_int32_t seq_sent, seq_recv;
-static u_int16_t pptp_gre_call_id, pptp_gre_peer_call_id;
+static uint32_t ack_sent, ack_recv;
+static uint32_t seq_sent, seq_recv;
+static uint16_t pptp_gre_call_id, pptp_gre_peer_call_id;
gre_stats_t stats;
typedef int (*callback_t)(int cl, void *pack, unsigned int len);
@@ -122,7 +123,7 @@ int pptp_gre_bind(struct in_addr inetaddr)
}
/*** pptp_gre_copy ************************************************************/
-void pptp_gre_copy(u_int16_t call_id, u_int16_t peer_call_id,
+void pptp_gre_copy(uint16_t call_id, uint16_t peer_call_id,
int pty_fd, int gre_fd)
{
int max_fd;
@@ -286,7 +287,7 @@ int decaps_hdlc(int fd, int (*cb)(int cl, void *pack, unsigned int len), int cl)
/* check, then remove the 16-bit FCS checksum field */
if (pppfcs16 (PPPINITFCS16, copy, len) != PPPGOODFCS16)
warn("Bad Frame Check Sequence during PPP to GRE decapsulation");
- len -= sizeof(u_int16_t);
+ len -= sizeof(uint16_t);
/* so now we have a packet of length 'len' in 'copy' */
if ((status = cb (cl, copy, len)) < 0)
return status; /* error-check */
@@ -303,7 +304,7 @@ int encaps_hdlc(int fd, void *pack, unsigned int len)
unsigned char *source = (unsigned char *)pack;
unsigned char dest[2 * PACKET_MAX + 2]; /* largest expansion possible */
unsigned int pos = 0, i;
- u_int16_t fcs;
+ uint16_t fcs;
/* in synchronous mode there is little to do */
if ( syncppp )
return write(fd, source, len);
@@ -341,7 +342,7 @@ int decaps_gre (int fd, callback_t callback, int cl)
static int first = 1;
unsigned int headersize;
unsigned int payload_len;
- u_int32_t seq;
+ uint32_t seq;
if ((status = read (fd, buffer, sizeof(buffer))) <= 0) {
warn("short read (%d): %s", status, strerror(errno));
@@ -379,7 +380,7 @@ int decaps_gre (int fd, callback_t callback, int cl)
if (ntoh16(header->call_id) != pptp_gre_call_id) return 0;
/* test if acknowledgement present */
if (PPTP_GRE_IS_A(ntoh8(header->ver))) {
- u_int32_t ack = (PPTP_GRE_IS_S(ntoh8(header->flags)))?
+ uint32_t ack = (PPTP_GRE_IS_S(ntoh8(header->flags)))?
header->ack:header->seq; /* ack in different place if S = 0 */
ack = ntoh32( ack);
if (ack > ack_recv) ack_recv = ack;
@@ -483,7 +484,7 @@ int encaps_gre (int fd, void *pack, unsigned int len)
struct pptp_gre_header header;
unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)];
} u;
- static u_int32_t seq = 1; /* first sequence number sent must be 1 */
+ static uint32_t seq = 1; /* first sequence number sent must be 1 */
unsigned int header_len;
int rc;
/* package this up in a GRE shell. */
diff --git pptp_gre.h pptp_gre.h
index 01604a6..0d1cca0 100644
--- pptp_gre.h
+++ pptp_gre.h
@@ -5,10 +5,11 @@
* $Id: pptp_gre.h,v 1.6 2008/02/19 05:05:03 quozl Exp $
*/
+#include <stdint.h>
#include "pptp_compat.h"
int pptp_gre_bind(struct in_addr inetaddr);
-void pptp_gre_copy(u_int16_t call_id, u_int16_t peer_call_id,
+void pptp_gre_copy(uint16_t call_id, uint16_t peer_call_id,
int pty_fd, int gre_fd);
extern int syncppp;
diff --git pptp_msg.h pptp_msg.h
index f7c231c..010e6b3 100644
--- pptp_msg.h
+++ pptp_msg.h
@@ -9,6 +9,7 @@
/* Grab definitions of int16, int32, etc. */
#include <sys/types.h>
+#include <stdint.h>
#include "pptp_compat.h"
/* define "portable" htons, etc. */
#define hton8(x) (x)
@@ -82,25 +83,25 @@
/* PPTP datagram structures (all data in network byte order): ----------*/
struct pptp_header {
- u_int16_t length; /* message length in octets, including header */
- u_int16_t pptp_type; /* PPTP message type. 1 for control message. */
- u_int32_t magic; /* this should be PPTP_MAGIC. */
- u_int16_t ctrl_type; /* Control message type (0-15) */
- u_int16_t reserved0; /* reserved. MUST BE ZERO. */
+ uint16_t length; /* message length in octets, including header */
+ uint16_t pptp_type; /* PPTP message type. 1 for control message. */
+ uint32_t magic; /* this should be PPTP_MAGIC. */
+ uint16_t ctrl_type; /* Control message type (0-15) */
+ uint16_t reserved0; /* reserved. MUST BE ZERO. */
};
struct pptp_start_ctrl_conn { /* for control message types 1 and 2 */
struct pptp_header header;
- u_int16_t version; /* PPTP protocol version. = PPTP_VERSION */
- u_int8_t result_code; /* these two fields should be zero on rqst msg*/
- u_int8_t error_code; /* 0 unless result_code==2 (General Error) */
- u_int32_t framing_cap; /* Framing capabilities */
- u_int32_t bearer_cap; /* Bearer Capabilities */
- u_int16_t max_channels; /* Maximum Channels (=0 for PNS, PAC ignores) */
- u_int16_t firmware_rev; /* Firmware or Software Revision */
- u_int8_t hostname[64]; /* Host Name (64 octets, zero terminated) */
- u_int8_t vendor[64]; /* Vendor string (64 octets, zero term.) */
+ uint16_t version; /* PPTP protocol version. = PPTP_VERSION */
+ uint8_t result_code; /* these two fields should be zero on rqst msg*/
+ uint8_t error_code; /* 0 unless result_code==2 (General Error) */
+ uint32_t framing_cap; /* Framing capabilities */
+ uint32_t bearer_cap; /* Bearer Capabilities */
+ uint16_t max_channels; /* Maximum Channels (=0 for PNS, PAC ignores) */
+ uint16_t firmware_rev; /* Firmware or Software Revision */
+ uint8_t hostname[64]; /* Host Name (64 octets, zero terminated) */
+ uint8_t vendor[64]; /* Vendor string (64 octets, zero term.) */
/* MS says that end of hostname/vendor fields should be filled with */
/* octets of value 0, but Win95 PPTP driver doesn't do this. */
};
@@ -108,122 +109,122 @@ struct pptp_start_ctrl_conn { /* for control message types 1 and 2 */
struct pptp_stop_ctrl_conn { /* for control message types 3 and 4 */
struct pptp_header header;
- u_int8_t reason_result; /* reason for rqst, result for rply */
- u_int8_t error_code; /* MUST be 0, unless rply result==2 (general err)*/
- u_int16_t reserved1; /* MUST be 0 */
+ uint8_t reason_result; /* reason for rqst, result for rply */
+ uint8_t error_code; /* MUST be 0, unless rply result==2 (general err)*/
+ uint16_t reserved1; /* MUST be 0 */
};
struct pptp_echo_rqst { /* for control message type 5 */
struct pptp_header header;
- u_int32_t identifier; /* arbitrary value set by sender which is used */
+ uint32_t identifier; /* arbitrary value set by sender which is used */
/* to match up reply and request */
};
struct pptp_echo_rply { /* for control message type 6 */
struct pptp_header header;
- u_int32_t identifier; /* should correspond to id of rqst */
- u_int8_t result_code;
- u_int8_t error_code; /* =0, unless result_code==2 (general error) */
- u_int16_t reserved1; /* MUST BE ZERO */
+ uint32_t identifier; /* should correspond to id of rqst */
+ uint8_t result_code;
+ uint8_t error_code; /* =0, unless result_code==2 (general error) */
+ uint16_t reserved1; /* MUST BE ZERO */
};
struct pptp_out_call_rqst { /* for control message type 7 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (unique id used to multiplex data) */
- u_int16_t call_sernum; /* Call Serial Number (used for logging) */
- u_int32_t bps_min; /* Minimum BPS (lowest acceptable line speed) */
- u_int32_t bps_max; /* Maximum BPS (highest acceptable line speed) */
- u_int32_t bearer; /* Bearer type */
- u_int32_t framing; /* Framing type */
- u_int16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
- u_int16_t delay; /* Packet Processing Delay (in 1/10 sec) */
- u_int16_t phone_len; /* Phone Number Length (num. of valid digits) */
- u_int16_t reserved1; /* MUST BE ZERO */
- u_int8_t phone_num[64]; /* Phone Number (64 octets, null term.) */
- u_int8_t subaddress[64]; /* Subaddress (64 octets, null term.) */
+ uint16_t call_id; /* Call ID (unique id used to multiplex data) */
+ uint16_t call_sernum; /* Call Serial Number (used for logging) */
+ uint32_t bps_min; /* Minimum BPS (lowest acceptable line speed) */
+ uint32_t bps_max; /* Maximum BPS (highest acceptable line speed) */
+ uint32_t bearer; /* Bearer type */
+ uint32_t framing; /* Framing type */
+ uint16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
+ uint16_t delay; /* Packet Processing Delay (in 1/10 sec) */
+ uint16_t phone_len; /* Phone Number Length (num. of valid digits) */
+ uint16_t reserved1; /* MUST BE ZERO */
+ uint8_t phone_num[64]; /* Phone Number (64 octets, null term.) */
+ uint8_t subaddress[64]; /* Subaddress (64 octets, null term.) */
};
struct pptp_out_call_rply { /* for control message type 8 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
- u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
- u_int8_t result_code; /* Result Code (1 is no errors) */
- u_int8_t error_code; /* Error Code (=0 unless result_code==2) */
- u_int16_t cause_code; /* Cause Code (addt'l failure information) */
- u_int32_t speed; /* Connect Speed (in BPS) */
- u_int16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
- u_int16_t delay; /* Packet Processing Delay (in 1/10 sec) */
- u_int32_t channel; /* Physical Channel ID (for logging) */
+ uint16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
+ uint16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
+ uint8_t result_code; /* Result Code (1 is no errors) */
+ uint8_t error_code; /* Error Code (=0 unless result_code==2) */
+ uint16_t cause_code; /* Cause Code (addt'l failure information) */
+ uint32_t speed; /* Connect Speed (in BPS) */
+ uint16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
+ uint16_t delay; /* Packet Processing Delay (in 1/10 sec) */
+ uint32_t channel; /* Physical Channel ID (for logging) */
};
struct pptp_in_call_rqst { /* for control message type 9 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (unique id used to multiplex data) */
- u_int16_t call_sernum; /* Call Serial Number (used for logging) */
- u_int32_t bearer; /* Bearer type */
- u_int32_t channel; /* Physical Channel ID (for logging) */
- u_int16_t dialed_len; /* Dialed Number Length (# of valid digits) */
- u_int16_t dialing_len; /* Dialing Number Length (# of valid digits) */
- u_int8_t dialed_num[64]; /* Dialed Number (64 octets, zero term.) */
- u_int8_t dialing_num[64]; /* Dialing Number (64 octets, zero term.) */
- u_int8_t subaddress[64]; /* Subaddress (64 octets, zero term.) */
+ uint16_t call_id; /* Call ID (unique id used to multiplex data) */
+ uint16_t call_sernum; /* Call Serial Number (used for logging) */
+ uint32_t bearer; /* Bearer type */
+ uint32_t channel; /* Physical Channel ID (for logging) */
+ uint16_t dialed_len; /* Dialed Number Length (# of valid digits) */
+ uint16_t dialing_len; /* Dialing Number Length (# of valid digits) */
+ uint8_t dialed_num[64]; /* Dialed Number (64 octets, zero term.) */
+ uint8_t dialing_num[64]; /* Dialing Number (64 octets, zero term.) */
+ uint8_t subaddress[64]; /* Subaddress (64 octets, zero term.) */
};
struct pptp_in_call_rply { /* for control message type 10 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
- u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
- u_int8_t result_code; /* Result Code (1 is no errors) */
- u_int8_t error_code; /* Error Code (=0 unless result_code==2) */
- u_int16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
- u_int16_t delay; /* Packet Processing Delay (in 1/10 sec) */
- u_int16_t reserved1; /* MUST BE ZERO */
+ uint16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
+ uint16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
+ uint8_t result_code; /* Result Code (1 is no errors) */
+ uint8_t error_code; /* Error Code (=0 unless result_code==2) */
+ uint16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
+ uint16_t delay; /* Packet Processing Delay (in 1/10 sec) */
+ uint16_t reserved1; /* MUST BE ZERO */
};
struct pptp_in_call_connect { /* for control message type 11 */
struct pptp_header header;
- u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
- u_int16_t reserved1; /* MUST BE ZERO */
- u_int32_t speed; /* Connect Speed (in BPS) */
- u_int16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
- u_int16_t delay; /* Packet Processing Delay (in 1/10 sec) */
- u_int32_t framing; /* Framing type */
+ uint16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
+ uint16_t reserved1; /* MUST BE ZERO */
+ uint32_t speed; /* Connect Speed (in BPS) */
+ uint16_t recv_size; /* Recv. Window Size (no. of buffered packets) */
+ uint16_t delay; /* Packet Processing Delay (in 1/10 sec) */
+ uint32_t framing; /* Framing type */
};
struct pptp_call_clear_rqst { /* for control message type 12 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
- u_int16_t reserved1; /* MUST BE ZERO */
+ uint16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
+ uint16_t reserved1; /* MUST BE ZERO */
};
struct pptp_call_clear_ntfy { /* for control message type 13 */
struct pptp_header header;
- u_int16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
- u_int8_t result_code; /* Result Code */
- u_int8_t error_code; /* Error Code (=0 unless result_code==2) */
- u_int16_t cause_code; /* Cause Code (for ISDN, is Q.931 cause code) */
- u_int16_t reserved1; /* MUST BE ZERO */
- u_int8_t call_stats[128]; /* Call Statistics: 128 octets, ascii, 0-term */
+ uint16_t call_id; /* Call ID (used to multiplex data over tunnel)*/
+ uint8_t result_code; /* Result Code */
+ uint8_t error_code; /* Error Code (=0 unless result_code==2) */
+ uint16_t cause_code; /* Cause Code (for ISDN, is Q.931 cause code) */
+ uint16_t reserved1; /* MUST BE ZERO */
+ uint8_t call_stats[128]; /* Call Statistics: 128 octets, ascii, 0-term */
};
struct pptp_wan_err_ntfy { /* for control message type 14 */
struct pptp_header header;
- u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
- u_int16_t reserved1; /* MUST BE ZERO */
- u_int32_t crc_errors; /* CRC errors */
- u_int32_t frame_errors; /* Framing errors */
- u_int32_t hard_errors; /* Hardware overruns */
- u_int32_t buff_errors; /* Buffer overruns */
- u_int32_t time_errors; /* Time-out errors */
- u_int32_t align_errors; /* Alignment errors */
+ uint16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst)*/
+ uint16_t reserved1; /* MUST BE ZERO */
+ uint32_t crc_errors; /* CRC errors */
+ uint32_t frame_errors; /* Framing errors */
+ uint32_t hard_errors; /* Hardware overruns */
+ uint32_t buff_errors; /* Buffer overruns */
+ uint32_t time_errors; /* Time-out errors */
+ uint32_t align_errors; /* Alignment errors */
};
struct pptp_set_link_info { /* for control message type 15 */
struct pptp_header header;
- u_int16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst) */
- u_int16_t reserved1; /* MUST BE ZERO */
- u_int32_t send_accm; /* Send ACCM (for PPP packets; default 0xFFFFFFFF)*/
- u_int32_t recv_accm; /* Receive ACCM (for PPP pack.;default 0xFFFFFFFF)*/
+ uint16_t call_id_peer; /* Peer's Call ID (call_id of pptp_out_call_rqst) */
+ uint16_t reserved1; /* MUST BE ZERO */
+ uint32_t send_accm; /* Send ACCM (for PPP packets; default 0xFFFFFFFF)*/
+ uint32_t recv_accm; /* Receive ACCM (for PPP pack.;default 0xFFFFFFFF)*/
};
/* helpful #defines: -------------------------------------------- */
@@ -291,13 +292,13 @@ max(sizeof(struct pptp_set_link_info), 0)))))))))))))
#define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A)
struct pptp_gre_header {
- u_int8_t flags; /* bitfield */
- u_int8_t ver; /* should be PPTP_GRE_VER (enhanced GRE) */
- u_int16_t protocol; /* should be PPTP_GRE_PROTO (ppp-encaps) */
- u_int16_t payload_len; /* size of ppp payload, not inc. gre header */
- u_int16_t call_id; /* peer's call_id for this session */
- u_int32_t seq; /* sequence number. Present if S==1 */
- u_int32_t ack; /* seq number of highest packet recieved by */
+ uint8_t flags; /* bitfield */
+ uint8_t ver; /* should be PPTP_GRE_VER (enhanced GRE) */
+ uint16_t protocol; /* should be PPTP_GRE_PROTO (ppp-encaps) */
+ uint16_t payload_len; /* size of ppp payload, not inc. gre header */
+ uint16_t call_id; /* peer's call_id for this session */
+ uint32_t seq; /* sequence number. Present if S==1 */
+ uint32_t ack; /* seq number of highest packet recieved by */
/* sender in this session */
};
diff --git pqueue.c pqueue.c
index 41507ff..c07e850 100644
--- pqueue.c
+++ pqueue.c
@@ -17,7 +17,7 @@
#define MIN_CAPACITY 128 /* min allocated buffer for a packet */
-static int pqueue_alloc (u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new);
+static int pqueue_alloc (uint32_t seq, unsigned char *packet, int packlen, pqueue_t **new);
int packet_timeout_usecs = DEFAULT_PACKET_TIMEOUT * 1000000;
@@ -29,7 +29,7 @@ static pqueue_t *pq_freelist_head = NULL;
-static int pqueue_alloc(u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new) {
+static int pqueue_alloc(uint32_t seq, unsigned char *packet, int packlen, pqueue_t **new) {
pqueue_t *newent;
@@ -125,7 +125,7 @@ static int pqueue_alloc(u_int32_t seq, unsigned char *packet, int packlen, pqueu
-int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen) {
+int pqueue_add (uint32_t seq, unsigned char *packet, int packlen) {
pqueue_t *newent, *point;
/* get a new entry */
diff --git pqueue.h pqueue.h
index a56590f..19bc7e2 100644
--- pqueue.h
+++ pqueue.h
@@ -1,6 +1,7 @@
#ifndef PQUEUE_H
#define PQUEUE_H
+#include <stdint.h>
#include <time.h>
#include <sys/time.h>
@@ -15,14 +16,14 @@ extern int packet_timeout_usecs;
typedef struct pqueue {
struct pqueue *next;
struct pqueue *prev;
- u_int32_t seq;
+ uint32_t seq;
struct timeval expires;
unsigned char *packet;
int packlen;
int capacity;
} pqueue_t;
-int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen);
+int pqueue_add (uint32_t seq, unsigned char *packet, int packlen);
int pqueue_del (pqueue_t *point);
pqueue_t *pqueue_head (void);
int pqueue_expiry_time (pqueue_t *entry);