MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_ppp_addproto

Function ng_ppp_addproto

freebsd/netgraph/ng_ppp.c:2417–2429  ·  view source on GitHub ↗

* Prepend a possibly compressed PPP protocol number in front of a frame */

Source from the content-addressed store, hash-verified

2415 * Prepend a possibly compressed PPP protocol number in front of a frame
2416 */
2417static struct mbuf *
2418ng_ppp_addproto(struct mbuf *m, uint16_t proto, int compOK)
2419{
2420 if (compOK && PROT_COMPRESSABLE(proto)) {
2421 uint8_t pbyte = (uint8_t)proto;
2422
2423 return ng_ppp_prepend(m, &pbyte, 1);
2424 } else {
2425 uint16_t pword = htons((uint16_t)proto);
2426
2427 return ng_ppp_prepend(m, &pword, 2);
2428 }
2429}
2430
2431/*
2432 * Cut a possibly compressed PPP protocol number from the front of a frame.

Callers 5

ng_ppp_comp_xmitFunction · 0.85
ng_ppp_comp_recvFunction · 0.85
ng_ppp_crypt_xmitFunction · 0.85
ng_ppp_link_xmitFunction · 0.85
ng_ppp_mp_xmitFunction · 0.85

Calls 1

ng_ppp_prependFunction · 0.85

Tested by

no test coverage detected