diff options
author | Kristen Carlson Accardi <kristen@linux.intel.com> | 2010-05-13 10:31:32 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-05-19 02:58:45 -0500 |
commit | 3fff4c49c8de500a6355e012c7246890368b2cb7 (patch) | |
tree | dcc11fd6608fad5ac80c14af92125364ccd458e9 /gatchat/gatppp.c | |
parent | 0d8b86ed79ff6f12d35c5c155e858e3c174af34b (diff) | |
download | ofono-3fff4c49c8de500a6355e012c7246890368b2cb7.tar.gz |
ppp: implement ppp_packet_new
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r-- | gatchat/gatppp.c | 15 |
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 */ |