summaryrefslogtreecommitdiffstats
path: root/gatchat/gatppp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r--gatchat/gatppp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 82d1eca5..8d62b07a 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -84,6 +84,21 @@ void ppp_debug(GAtPPP *ppp, const char *str)
ppp->debugf(str, ppp->debug_data);
}
+struct ppp_header *ppp_packet_new(gsize infolen, guint16 protocol)
+{
+ struct ppp_header *ppp_packet;
+
+ ppp_packet = g_try_malloc0(infolen + sizeof(*ppp_packet));
+ if (ppp_packet == NULL)
+ return NULL;
+
+ ppp_packet->proto = htons(protocol);
+ ppp_packet->address = PPP_ADDR_FIELD;
+ ppp_packet->control = PPP_CTRL;
+
+ return ppp_packet;
+}
+
/*
* Silently discard packets which are received when they shouldn't be
*/