void ppp_set_auth(GAtPPP *ppp, const guint8* auth_data) { guint16 proto = get_host_short(auth_data); switch (proto) { case CHAP_PROTOCOL: if (ppp->chap) ppp_chap_free(ppp->chap); ppp->chap = ppp_chap_new(ppp, auth_data[2]); break; default: g_printerr("unknown authentication proto\n"); break; } }
void ppp_net_process_packet(struct ppp_net *net, const guint8 *packet, gsize plen) { GIOStatus status; gsize bytes_written; guint16 len; if (plen < 4) return; /* find the length of the packet to transmit */ len = get_host_short(&packet[2]); status = g_io_channel_write_chars(net->channel, (gchar *) packet, MIN(len, plen), &bytes_written, NULL); if (status != G_IO_STATUS_NORMAL) return; }
/* * The only time we use other than default MTU is when we are in * the network phase. */ void ppp_set_mtu(GAtPPP *ppp, const guint8 *data) { guint16 mtu = get_host_short(data); ppp->mtu = mtu; }