You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/06/20 21:42:25 UTC
[23/51] [partial] incubator-mynewt-site git commit: generated two
versions of docs - develop and v0_9_0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/d18c34dd/develop/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
----------------------------------------------------------------------
diff --git a/develop/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html b/develop/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
new file mode 100644
index 0000000..d4f59c6
--- /dev/null
+++ b/develop/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/index.html
@@ -0,0 +1,952 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/core_os/mbuf/OS_MBUF_USRHDR_LEN/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>OS_MBUF_USRHDR_LEN - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.css" rel="stylesheet">
+ <link rel="stylesheet" href="../../../../css/highlight.css">
+ <link href="../../../../css/base.css" rel="stylesheet">
+ <link href="../../../../css/custom.css" rel="stylesheet">
+ <link href="../../../../css/v2.css" rel="stylesheet">
+ <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-72162311-1', 'auto');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="OS_MBUF_USRHDR_LEN">
+
+
+
+
+
+
+
+
+
+<nav id="navbar" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <div class="container">
+ <!-- Collapsed navigation -->
+ <div class="navbar-header">
+ <!-- Expander button -->
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ </div>
+
+ <!-- Expanded navigation -->
+ <div class="navbar-collapse collapse">
+ <!-- Main navigation -->
+ <ul class="nav navbar-nav navbar-right">
+ <li
+ class=""
+>
+ <a href="/">Home</a>
+ </li>
+ <li
+ class="important"
+>
+ <a href="/quick-start/">Quick Start</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/about/">About</a>
+ </li>
+ <li
+ class="active"
+>
+ <a href="/latest/os/introduction">Documentation</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/download/">Download</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/community/">Community</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</nav>
+
+
+
+ <div class="container">
+
+ <div class="row">
+ <div class="col-md-3 v2-sidebar"><div id="docSidebar" class="hidden-print" role="complementary">
+ <div class="top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div role="search">
+ <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" class="form-control" placeholder="Search documentation" />
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="toc-nav">
+ <li class="doc-version">
+<select class="form-control" onchange="if (this.value) window.location.href=this.value">
+
+ <option
+ value="/develop/os/introduction"
+ selected="selected"
+ >
+ Version: develop
+ </option>
+
+ <option
+ value="/v0_9_0/os/introduction"
+
+ >
+ Version: 0.9.0 (latest)
+ </option>
+
+</select>
+</li>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li ><a href="../../../introduction/">Mynewt Documentation</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../../get_started/get_started/">Basic Setup</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../get_started/vocabulary/">Concepts</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../tutorials/tutorials/">Tutorials</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os_user_guide/">OS User Guide</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../mynewt_os/">OS Core</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../os_init/
+">System-level Functions</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../context_switch/context_switch/">Scheduler</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../time/os_time/">Time</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../task/task/">Tasks</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../event_queue/event_queue/">Event Queues</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../semaphore/semaphore/">Semaphores</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mutex/mutex/">Mutexes</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../memory_pool/memory_pool/">Memory Pools</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../heap/heap/">Heap</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../mbuf/
+
+">Memory Buffers</a>
+
+
+ <ul>
+
+
+
+
+
+ <li ><a href="../mbuf/">Mbuf</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../OS_MBUF_PKTHDR/
+">Functions/Macros</a>
+
+
+ <ul>
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTHDR/">OS_MBUF_PKTHDR</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTHDR_TO_MBUF/">OS_MBUF_PKTHDR_TO_MBUF</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTLEN/">OS_MBUF_PKTLEN</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_DATA/">OS_MBUF_DATA</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_USRHDR/">OS_MBUF_USRHDR</a>
+ </li>
+
+
+
+
+
+ <li class="active">
+ <a href="./">OS_MBUF_USRHDR_LEN</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_LEADINGSPACE/">OS_MBUF_LEADINGSPACE</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_TRAILINGSPACE/">OS_MBUF_TRAILINGSPACE</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_adj/">os_mbuf_adj</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_append/">os_mbuf_append</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_concat/">os_mbuf_concat</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_copydata/">os_mbuf_copydata</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_copyinto/">os_mbuf_copyinto</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_dup/">os_mbuf_dup</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_extend/">os_mbuf_extend</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_free_chain/">os_mbuf_free_chain</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_get/">os_mbuf_get</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_get_pkthdr/">os_mbuf_get_pkthdr</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_memcmp/">os_mbuf_memcmp</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_off/">os_mbuf_off</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_pool_init/">os_mbuf_pool_init</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_prepend/">os_mbuf_prepend</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_pullup/">os_mbuf_pullup</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../msys/msys/">Msys</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mqueue/mqueue/">MQueue</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../sanity/sanity/">Sanity</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../callout/callout/">Callouts</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../porting/port_os/">Porting to your Platform</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/console/console/">Console</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/shell/shell/">Shell</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/bootloader/bootloader/">Bootloader</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../modules/fs/fs/fs/
+
+">File System</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/hal/hal/">Hardware Abstraction Layer</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/testutil/testutil/">Test Utilities</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/imgmgr/imgmgr/">Image Manager</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../modules/baselibc/">Baselibc library</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/elua/elua/">Embedded Lua</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/json/json/">JSON</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/stats/stats/">Stats</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/logs/logs/">Logs</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../network/ble/ble_intro/
+">BLE User Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newt/newt_intro/">Newt Tool Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newtmgr/overview/">Newt Manager Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../faq/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-9" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-12">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs pull-right">
+ <li><a href="/develop/os/introduction">Docs</a></li>
+
+
+
+ <li>» <a href="../mbuf/">Mbuf</a></li>
+
+
+
+ <li>» <a href="../OS_MBUF_PKTHDR/">Functions/Macros</a></li>
+
+
+
+ <li>» OS_MBUF_USRHDR_LEN</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="os_mbuf_usrhdr_len"><font color="#F2853F" style="font-size:24pt">OS_MBUF_USRHDR_LEN</font></h2>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #000000">OS_MBUF_USRHDR_LEN</span>(<span style="color: #000000">__om</span>)
+</pre></div>
+
+
+<p>Macro used to retrieve the length of the user packet header in an mbuf.</p>
+<p><br></p>
+<h4 id="arguments">Arguments</h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>__om</td>
+<td>Pointer to mbuf (struct os_mbuf *). Must be head of chain (i.e. a packet header mbuf)</td>
+</tr>
+</tbody>
+</table>
+<p><br></p>
+<h4 id="example">Example</h4>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">user_length</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf</span> <span style="color: #000000">*om</span>
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">user_header</span> <span style="color: #000000">*hdr</span>;
+
+ <span style="color: #000000">user_length</span> <span style="color: #000000">=</span> <span style="color: #000000">OS_MBUF_USRHDR_LEN</span>(<span style="color: #000000">om</span>);
+</pre></div>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../OS_MBUF_USRHDR/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: OS_MBUF_USRHDR
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../OS_MBUF_LEADINGSPACE/>
+ Next: OS_MBUF_LEADINGSPACE
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+
+ <script src="../../../../js/jquery-1.10.2.min.js"></script>
+ <script src="../../../../js/bootstrap-3.0.3.min.js"></script>
+ <script src="../../../../js/highlight.pack.js"></script>
+ <script src="../../../../js/base.js"></script>
+ <script src="../../../../js/custom.js"></script>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/d18c34dd/develop/os/core_os/mbuf/mbuf/index.html
----------------------------------------------------------------------
diff --git a/develop/os/core_os/mbuf/mbuf/index.html b/develop/os/core_os/mbuf/mbuf/index.html
new file mode 100644
index 0000000..876ca57
--- /dev/null
+++ b/develop/os/core_os/mbuf/mbuf/index.html
@@ -0,0 +1,1006 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/core_os/mbuf/mbuf/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>toc - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.css" rel="stylesheet">
+ <link rel="stylesheet" href="../../../../css/highlight.css">
+ <link href="../../../../css/base.css" rel="stylesheet">
+ <link href="../../../../css/custom.css" rel="stylesheet">
+ <link href="../../../../css/v2.css" rel="stylesheet">
+ <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-72162311-1', 'auto');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="toc">
+
+
+
+
+
+
+
+
+
+<nav id="navbar" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <div class="container">
+ <!-- Collapsed navigation -->
+ <div class="navbar-header">
+ <!-- Expander button -->
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ </div>
+
+ <!-- Expanded navigation -->
+ <div class="navbar-collapse collapse">
+ <!-- Main navigation -->
+ <ul class="nav navbar-nav navbar-right">
+ <li
+ class=""
+>
+ <a href="/">Home</a>
+ </li>
+ <li
+ class="important"
+>
+ <a href="/quick-start/">Quick Start</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/about/">About</a>
+ </li>
+ <li
+ class="active"
+>
+ <a href="/latest/os/introduction">Documentation</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/download/">Download</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/community/">Community</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</nav>
+
+
+
+ <div class="container">
+
+ <div class="row">
+ <div class="col-md-3 v2-sidebar"><div id="docSidebar" class="hidden-print" role="complementary">
+ <div class="top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div role="search">
+ <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" class="form-control" placeholder="Search documentation" />
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="toc-nav">
+ <li class="doc-version">
+<select class="form-control" onchange="if (this.value) window.location.href=this.value">
+
+ <option
+ value="/develop/os/introduction"
+ selected="selected"
+ >
+ Version: develop
+ </option>
+
+ <option
+ value="/v0_9_0/os/introduction"
+
+ >
+ Version: 0.9.0 (latest)
+ </option>
+
+</select>
+</li>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li ><a href="../../../introduction/">Mynewt Documentation</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../../get_started/get_started/">Basic Setup</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../get_started/vocabulary/">Concepts</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../tutorials/tutorials/">Tutorials</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os_user_guide/">OS User Guide</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../mynewt_os/">OS Core</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../os_init/
+">System-level Functions</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../context_switch/context_switch/">Scheduler</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../time/os_time/">Time</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../task/task/">Tasks</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../event_queue/event_queue/">Event Queues</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../semaphore/semaphore/">Semaphores</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mutex/mutex/">Mutexes</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../memory_pool/memory_pool/">Memory Pools</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../heap/heap/">Heap</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ./
+
+">Memory Buffers</a>
+
+
+ <ul>
+
+
+
+
+
+ <li class="active"><a href="./">Mbuf</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../OS_MBUF_PKTHDR/
+">Functions/Macros</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../msys/msys/">Msys</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mqueue/mqueue/">MQueue</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../sanity/sanity/">Sanity</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../callout/callout/">Callouts</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../porting/port_os/">Porting to your Platform</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/console/console/">Console</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/shell/shell/">Shell</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/bootloader/bootloader/">Bootloader</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../modules/fs/fs/fs/
+
+">File System</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/hal/hal/">Hardware Abstraction Layer</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/testutil/testutil/">Test Utilities</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/imgmgr/imgmgr/">Image Manager</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../modules/baselibc/">Baselibc library</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/elua/elua/">Embedded Lua</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/json/json/">JSON</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/stats/stats/">Stats</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/logs/logs/">Logs</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../network/ble/ble_intro/
+">BLE User Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newt/newt_intro/">Newt Tool Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newtmgr/overview/">Newt Manager Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../faq/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-9" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-12">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs pull-right">
+ <li><a href="/develop/os/introduction">Docs</a></li>
+
+
+
+ <li>» Memory Buffers</li>
+
+
+
+ <li>» Mbuf</li>
+
+
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h1 id="mbufs">Mbufs</h1>
+<p>The mbuf (short for memory buffer) is a common concept in networking stacks. The mbuf is used to hold packet data as it traverses the stack. The mbuf also generally stores header information or other networking stack information that is carried around with the packet. The mbuf and its associated library of functions were developed to make common networking stack operations (like stripping and adding protocol headers) efficient and as copy-free as possible.</p>
+<p>In its simplest form, an mbuf is a memory block with some space reserved for internal information and a pointer which is used to "chain" memory blocks together in order to create a "packet". This is a very important aspect of the mbuf: the ability to chain mbufs together to create larger "packets" (chains of mbufs).</p>
+<h3 id="why-use-mbufs">Why use mbufs?</h3>
+<p>The main reason is to conserve memory. Consider a networking protocol that generally sends small packets but occasionally sends large ones. The Bluetooth Low Energy (BLE) protocol is one such example. A flat buffer would need to be sized so that the maximum packet size could be contained by the buffer. With the mbuf, a number of mbufs can be chained together so that the occasional large packet can be handled while leaving more packet buffers available to the networking stack for smaller packets.</p>
+<h3 id="packet-header-mbuf">Packet Header mbuf</h3>
+<p>Not all mbufs are created equal. The first mbuf in a chain of mbufs is a special mbuf called a "packet header mbuf". The reason that this mbuf is special is that it contains the length of all the data contained by the chain of mbufs (the packet length, in other words). The packet header mbuf may also contain a user defined structure (called a "user header") so that networking protocol specific information can be conveyed to various layers of the networking stack. Any mbufs that are part of the packet (i.e. in the mbuf chain but not the first one) are "normal" (i.e. non-packet header) mbufs. A normal mbuf does not have any packet header or user packet header structures in them; they only contain the basic mbuf header (<code>struct os_mbuf</code>). Figure 1 illustrates these two types of mbufs. Note that the numbers/text in parentheses denote the size of the structures/elements (in bytes) and that MBLEN is the memory block length of the memory pool used by the mbuf pool.</p>
+<p><img alt="Packet header mbuf" src="../pics/mbuf_fig1.png" /></p>
+<h3 id="normal-mbuf">Normal mbuf</h3>
+<p>Now let's take a deeper dive into the mbuf structure. Figure 2 illustrates a normal mbuf and breaks out the various fields in the <code>os_mbuf</code> structure. </p>
+<ul>
+<li>The <em>om_data</em> field is a pointer to where the data starts inside the data buffer. Typically, mbufs that are allocated from the mbuf pool (discussed later) have their om_data pointer set to the start of the data buffer but there are cases where this may not be desirable (added a protocol header to a packet, for example). </li>
+<li>The <em>om_flags</em> field is a set of flags used internally by the mbuf library. Currently, no flags have been defined. </li>
+<li>The <em>om_pkthdr_len</em> field is the total length of all packet headers in the mbuf. For normal mbufs this is set to 0 as there is no packet or user packet headers. For packet header mbufs, this would be set to the length of the packet header structure (16) plus the size of the user packet header (if any). Note that it is this field which differentiates packet header mbufs from normal mbufs (i.e. if <em>om_pkthdr_len</em> is zero, this is a normal mbuf; otherwise it is a packet header mbuf). </li>
+<li>The <em>om_len</em> field contains the amount of user data in the data buffer. When initially allocated, this field is 0 as there is no user data in the mbuf. </li>
+<li>The <em>omp_pool</em> field is a pointer to the pool from which this mbuf has been allocated. This is used internally by the mbuf library. </li>
+<li>The <em>omp_next</em> field is a linked list element which is used to chain mbufs.</li>
+</ul>
+<p>Figure 2 also shows a normal mbuf with actual values in the <code>os_mbuf</code> structure. This mbuf starts at address 0x1000 and is 256 bytes in total length. In this example, the user has copied 33 bytes into the data buffer starting at address 0x1010 (this is where om_data points). Note that the packet header length in this mbuf is 0 as it is not a packet header mbuf.</p>
+<p><img alt="OS mbuf structure" src="../pics/mbuf_fig2.png" /></p>
+<p>Figure 3 illustrates the packet header mbuf along with some chained mbufs (i.e a "packet"). In this example, the user header structure is defined to be 8 bytes. Note that in figure 3 we show a number of different mbufs with varying <em>om_data</em> pointers and lengths since we want to show various examples of valid mbufs. For all the mbufs (both packet header and normal ones) the total length of the memory block is 128 bytes.</p>
+<p><img alt="Packet" src="../pics/mbuf_fig3.png" /></p>
+<h3 id="mbuf-pools">Mbuf pools</h3>
+<p>Mbufs are collected into "mbuf pools" much like memory blocks. The mbuf pool itself contains a pointer to a memory pool. The memory blocks in this memory pool are the actual mbufs; both normal and packet header mbufs. Thus, the memory block (and corresponding memory pool) must be sized correctly. In other words, the memory blocks which make up the memory pool used by the mbuf pool must be at least: sizeof(struct os_mbuf) + sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_defined_header) + desired minimum data buffer length. For example, if the developer wants mbufs to contain at least 64 bytes of user data and they have a user header of 12 bytes, the size of the memory block would be (at least): 64 + 12 + 16 + 8, or 100 bytes. Yes, this is a fair amount of overhead. However, the flexibility provided by the mbuf library usually outweighs overhead concerns.</p>
+<h3 id="create-mbuf-pool">Create mbuf pool</h3>
+<p>Creating an mbuf pool is fairly simple: create a memory pool and then create the mbuf pool using that memory pool. Once the developer has determined the size of the user data needed per mbuf (this is based on the application/networking stack and is outside the scope of this discussion) and the size of the user header (if any), the memory blocks can be sized. In the example shown below, the application requires 64 bytes of user data per mbuf and also allocates a user header (called struct user_hdr). Note that we do not show the user header data structure as there really is no need; all we need to do is to account for it when creating the memory pool. In the example, we use the macro <em>MBUF_PKTHDR_OVERHEAD</em> to denote the amount of packet header overhead per mbuf and <em>MBUF_MEMBLOCK_OVERHEAD</em> to denote the total amount of overhead required per memory block. The macro <em>MBUF_BUF_SIZE</em> is used to denote the amount of payload that the application requires (aligned on
a 32-bit boundary in this case). All this leads to the total memory block size required, denoted by the macro <em>MBUF_MEMBLOCK_OVERHEAD</em>.</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #633820">#define MBUF_PKTHDR_OVERHEAD sizeof(struct os_mbuf_pkthdr) + sizeof(struct user_hdr)</span>
+<span style="color: #633820">#define MBUF_MEMBLOCK_OVERHEAD sizeof(struct os_mbuf) + MBUF_PKTHDR_OVERHEAD</span>
+
+<span style="color: #633820">#define MBUF_NUM_MBUFS (32)</span>
+<span style="color: #633820">#define MBUF_PAYLOAD_SIZE (64)</span>
+<span style="color: #633820">#define MBUF_BUF_SIZE OS_ALIGN(MBUF_PAYLOAD_SIZE, 4)</span>
+<span style="color: #633820">#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + MBUF_MEMBLOCK_OVERHEAD)</span>
+<span style="color: #633820">#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)</span>
+
+<span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pool</span> <span style="color: #000000">g_mbuf_pool</span>;
+<span style="color: #A90D91">struct</span> <span style="color: #000000">os_mempool</span> <span style="color: #000000">g_mbuf_mempool</span>;
+<span style="color: #A90D91">os_membuf_t</span> <span style="color: #000000">g_mbuf_buffer</span>[<span style="color: #000000">MBUF_MEMPOOL_SIZE</span>];
+
+<span style="color: #A90D91">void</span>
+<span style="color: #000000">create_mbuf_pool</span>(<span style="color: #A90D91">void</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mempool_init</span>(<span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_NUM_MBUFS</span>,
+ <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>, <span style="color: #000000">&g_mbuf_buffer</span>[<span style="color: #1C01CE">0</span>], <span style="color: #C41A16">"mbuf_pool"</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pool_init</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #000000">&g_mbuf_mempool</span>, <span style="color: #000000">MBUF_MEMBLOCK_SIZE</span>,
+ <span style="color: #000000">MBUF_NUM_MBUFS</span>);
+ <span style="color: #000000">assert</span>(<span style="color: #000000">rc</span> <span style="color: #000000">==</span> <span style="color: #1C01CE">0</span>);
+}
+</pre></div>
+
+
+<h3 id="using-mbufs">Using mbufs</h3>
+<p>The following examples illustrate typical mbuf usage. There are two basic mbuf allocation API: <code>os_mbuf_get()</code> and <code>os_mbuf_get_pkthdr()</code>. The first API obtains a normal mbuf whereas the latter obtains a packet header mbuf. Typically, application developers use <code>os_mbuf_get_pkthdr()</code> and rarely, if ever, need to call <code>os_mbuf_get()</code> as the rest of the mbuf API (e.g. <code>os_mbuf_append()</code>, <code>os_mbuf_copyinto()</code>, etc.) typically deal with allocating and chaining mbufs. It is recommended to use the provided API to copy data into/out of mbuf chains and/or manipulate mbufs.</p>
+<p>In <code>example1</code>, the developer creates a packet and then sends the packet to a networking interface. The code sample also provides an example of copying data out of an mbuf as well as use of the "pullup" api (another very common mbuf api).</p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">void</span>
+<span style="color: #000000">mbuf_usage_example1</span>(<span style="color: #A90D91">uint8_t</span> <span style="color: #000000">*mydata</span>, <span style="color: #A90D91">int</span> <span style="color: #000000">mydata_length</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf</span> <span style="color: #000000">*om</span>;
+
+ <span style="color: #177500">/* get a packet header mbuf */</span>
+ <span style="color: #000000">om</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_get_pkthdr</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #A90D91">sizeof</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">user_hdr</span>));
+ <span style="color: #A90D91">if</span> (<span style="color: #000000">om</span>) {
+ <span style="color: #177500">/* </span>
+<span style="color: #177500"> * Copy user data into mbuf. NOTE: if mydata_length is greater than the</span>
+<span style="color: #177500"> * mbuf payload size (64 bytes using above example), mbufs are allocated</span>
+<span style="color: #177500"> * and chained together to accommodate the total packet length.</span>
+<span style="color: #177500"> */</span>
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_copyinto</span>(<span style="color: #000000">om</span>, <span style="color: #1C01CE">0</span>, <span style="color: #000000">mydata</span>, <span style="color: #000000">len</span>);
+ <span style="color: #A90D91">if</span> (<span style="color: #000000">rc</span>) {
+ <span style="color: #177500">/* Error! Could not allocate enough mbufs for total packet length */</span>
+ <span style="color: #A90D91">return</span> <span style="color: #000000">-</span><span style="color: #1C01CE">1</span>;
+ }
+
+ <span style="color: #177500">/* Send packet to networking interface */</span>
+ <span style="color: #000000">send_pkt</span>(<span style="color: #000000">om</span>);
+ }
+}
+</pre></div>
+
+
+<p>In <code>example2</code> we show use of the pullup api as this illustrates some of the typical pitfalls developers encounter when using mbufs. The first pitfall is one of alignment/padding. Depending on the processor and/or compiler, the sizeof() a structure may vary. Thus, the size of <em>my_protocol_header</em> may be different inside the packet data of the mbuf than the size of the structure on the stack or as a global variable, for instance. While some networking protcols may align protocol information on convenient processor boundaries many others try to conserve bytes "on the air" (i.e inside the packet data). Typical methods used to deal with this are "packing" the structure (i.e. force compiler to not pad) or creating protocol headers that do not require padding. <code>example2</code> assumes that one of these methods was used when defining the <em>my_protocol_header</em> structure.</p>
+<p>Another common pitfall occurs around endianness. A network protocol may be little endian or big endian; it all depends on the protocol specification. Processors also have an endianness; this means that the developer has to be careful that the processor endianness and the protocol endianness are handled correctly. In <code>example2</code>, some common networking functions are used: <code>ntohs()</code> and <code>ntohl()</code>. These are shorthand for "network order to host order, short" and "network order to host order, long". Basically, these functions convert data of a certain size (i.e. 16 bits, 32 bits, etc) to the endianness of the host. Network byte order is big-endian (most significant byte first), so these functions convert big-endian byte order to host order (thus, the implementation of these functions is host dependent). Note that the BLE networking stack "on the air" format is least signigicant byte first (i.e. little endian), so a "bletoh" function would have to take
little endian format and convert to host format.</p>
+<p>A long story short: the developer must take care when copying structure data to/from mbufs and flat buffers!</p>
+<p>A final note: these examples assume the same mbuf struture and definitions used in the first example. </p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">void</span>
+<span style="color: #000000">mbuf_usage_example2</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">mbuf</span> <span style="color: #000000">*rxpkt</span>)
+{
+ <span style="color: #A90D91">int</span> <span style="color: #000000">rc</span>;
+ <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">packet_data</span>[<span style="color: #1C01CE">16</span>];
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">mbuf</span> <span style="color: #000000">*om</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">my_protocol_header</span> <span style="color: #000000">*phdr</span>;
+
+ <span style="color: #177500">/* Make sure that "my_protocol_header" bytes are contiguous in mbuf */</span>
+ <span style="color: #000000">om</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_pullup</span>(<span style="color: #000000">&g_mbuf_pool</span>, <span style="color: #A90D91">sizeof</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">my_protocol_header</span>));
+ <span style="color: #A90D91">if</span> (<span style="color: #000000">!om</span>) {
+ <span style="color: #177500">/* Not able to pull up data into contiguous area */</span>
+ <span style="color: #A90D91">return</span> <span style="color: #000000">-</span><span style="color: #1C01CE">1</span>;
+ }
+
+ <span style="color: #177500">/* </span>
+<span style="color: #177500"> * Get the protocol information from the packet. In this example we presume that we</span>
+<span style="color: #177500"> * are interested in protocol types that are equal to MY_PROTOCOL_TYPE, are not zero</span>
+<span style="color: #177500"> * length, and have had some time in flight.</span>
+<span style="color: #177500"> */</span>
+ <span style="color: #000000">phdr</span> <span style="color: #000000">=</span> <span style="color: #000000">OS_MBUF_DATA</span>(<span style="color: #000000">om</span>, <span style="color: #A90D91">struct</span> <span style="color: #000000">my_protocol_header</span> <span style="color: #000000">*</span>);
+ <span style="color: #000000">type</span> <span style="color: #000000">=</span> <span style="color: #000000">ntohs</span>(<span style="color: #000000">phdr->prot_type</span>);
+ <span style="color: #000000">length</span> <span style="color: #000000">=</span> <span style="color: #000000">ntohs</span>(<span style="color: #000000">phdr->prot_length</span>);
+ <span style="color: #000000">time_in_flight</span> <span style="color: #000000">=</span> <span style="color: #000000">ntohl</span>(<span style="color: #000000">phdr->prot_tif</span>);
+
+ <span style="color: #A90D91">if</span> ((<span style="color: #000000">type</span> <span style="color: #000000">==</span> <span style="color: #000000">MY_PROTOCOL_TYPE</span>) <span style="color: #000000">&&</span> (<span style="color: #000000">length</span> <span style="color: #000000">></span> <span style="color: #1C01CE">0</span>) <span style="color: #000000">&&</span> (<span style="color: #000000">time_in_flight</span> <span style="color: #000000">></span> <span style="color: #1C01CE">0</span>)) {
+ <span style="color: #000000">rc</span> <span style="color: #000000">=</span> <span style="color: #000000">os_mbuf_copydata</span>(<span style="color: #000000">rxpkt</span>, <span style="color: #A90D91">sizeof</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">my_protocol_header</span>), <span style="color: #1C01CE">16</span>, <span style="color: #000000">packet_data</span>);
+ <span style="color: #A90D91">if</span> (<span style="color: #000000">!rc</span>) {
+ <span style="color: #177500">/* Success! Perform operations on packet data */</span>
+ <span style="color: #000000"><</span>... <span style="color: #000000">user</span> <span style="color: #000000">code</span> <span style="color: #000000">here</span> ...<span style="color: #000000">></span>
+ }
+ }
+
+ <span style="color: #177500">/* Free passed in packet (mbuf chain) since we don't need it anymore */</span>
+ <span style="color: #000000">os_mbuf_free_chain</span>(<span style="color: #000000">om</span>);
+}
+</pre></div>
+
+
+<p><br></p>
+<h3 id="data-structures">Data Structures</h3>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pool</span> {
+ <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">omp_databuf_len</span>;
+ <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">omp_mbuf_count</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">os_mempool</span> <span style="color: #000000">*omp_pool</span>;
+ <span style="color: #000000">STAILQ_ENTRY</span>(<span style="color: #000000">os_mbuf_pool</span>) <span style="color: #000000">omp_next</span>;
+};
+</pre></div>
+
+
+<table>
+<thead>
+<tr>
+<th><strong>Element</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>omp_databuf_len</td>
+<td>The length, in bytes, of the "data buffer" of the mbuf. The data buffer of the mbuf is everything except the os_mbuf structure (which is present in all types of mbufs)</td>
+</tr>
+<tr>
+<td>omp_mbuf_count</td>
+<td>Total number of mbufs in the pool when allocated. This is NOT the number of free mbufs in the pool!</td>
+</tr>
+<tr>
+<td>omp_pool</td>
+<td>The memory pool from which the mbufs are allocated</td>
+</tr>
+<tr>
+<td>omp_next</td>
+<td>This is a linked list pointer which chains memory pools. It is used by the system memory pool library</td>
+</tr>
+</tbody>
+</table>
+<p><br></p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pkthdr</span> {
+ <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">omp_len</span>;
+ <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">omp_flags</span>;
+ <span style="color: #000000">STAILQ_ENTRY</span>(<span style="color: #000000">os_mbuf_pkthdr</span>) <span style="color: #000000">omp_next</span>;
+};
+</pre></div>
+
+
+<table>
+<thead>
+<tr>
+<th><strong>Element</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>omp_len</td>
+<td>Length, in bytes, of the "packet". This is the sum of the user data in all the mbufs chained to the packet header mbuf (including the packet header mbuf)</td>
+</tr>
+<tr>
+<td>omp_flags</td>
+<td>Packet header flags.</td>
+</tr>
+<tr>
+<td>omp_next</td>
+<td>Linked list pointer to chain "packets". This can be used to add mbuf chains to a queue or linked list and is there for convenience.</td>
+</tr>
+</tbody>
+</table>
+<p><br></p>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf</span> {
+ <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">*om_data</span>;
+ <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">om_flags</span>;
+ <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">om_pkthdr_len</span>;
+ <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">om_len</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf_pool</span> <span style="color: #000000">*om_omp</span>;
+ <span style="color: #000000">SLIST_ENTRY</span>(<span style="color: #000000">os_mbuf</span>) <span style="color: #000000">om_next</span>;
+ <span style="color: #A90D91">uint8_t</span> <span style="color: #000000">om_databuf</span>[<span style="color: #1C01CE">0</span>];
+};
+</pre></div>
+
+
+<table>
+<thead>
+<tr>
+<th><strong>Element</strong></th>
+<th><strong>Description</strong></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>om_data</td>
+<td>Pointer to start of user data in mbuf data buffer</td>
+</tr>
+<tr>
+<td>om_flags</td>
+<td>mbuf flags field. Currently all flags unused.</td>
+</tr>
+<tr>
+<td>om_pkthdr_len</td>
+<td>The total length of all packet headers in the mbuf (mbuf packet header plus user packet header), in bytes</td>
+</tr>
+<tr>
+<td>om_len</td>
+<td>The length of the user data contained in this mbuf, in bytes</td>
+</tr>
+<tr>
+<td>om_omp</td>
+<td>Memory pool pointer. This is the mbuf pool from which this mbuf was allocated.</td>
+</tr>
+<tr>
+<td>om_next</td>
+<td>Pointer to next mbuf in packet chain</td>
+</tr>
+<tr>
+<td>om_databuf</td>
+<td>mbuf data buffer (accessor to start of mbuf data buffer). Note that the mbuf data buffer refers to the start of either the user data in normal mbufs or the start of the os mbuf packet header for packet header mbufs</td>
+</tr>
+</tbody>
+</table>
+<h3 id="list-of-functionsmacros">List of Functions/Macros</h3>
+<p>The functions/macros available in mbuf are:</p>
+<ul>
+<li><a href="../OS_MBUF_PKTHDR/">OS_MBUF_PKTHDR</a></li>
+<li><a href="../OS_MBUF_PKTHDR_TO_MBUF/">OS_MBUF_PKTHDR_TO_MBUF</a></li>
+<li><a href="../OS_MBUF_PKTLEN/">OS_MBUF_PKTLEN</a></li>
+<li><a href="../OS_MBUF_DATA/">OS_MBUF_DATA</a></li>
+<li><a href="../OS_MBUF_USRHDR/">OS_MBUF_USRHDR</a></li>
+<li><a href="../OS_MBUF_USRHDR_LEN/">OS_MBUF_USRHDR_LEN</a></li>
+<li><a href="../OS_MBUF_LEADINGSPACE/">OS_MBUF_LEADINGSPACE</a></li>
+<li><a href="../OS_MBUF_TRAILINGSPACE/">OS_MBUF_TRAILINGSPACE</a></li>
+<li><a href="../os_mbuf_adj/">os_mbuf_adj</a></li>
+<li><a href="../os_mbuf_append/">os_mbuf_append</a></li>
+<li><a href="../os_mbuf_concat/">os_mbuf_concat</a></li>
+<li><a href="../os_mbuf_copydata/">os_mbuf_copydata</a></li>
+<li><a href="../os_mbuf_copyinto/">os_mbuf_copyinto</a></li>
+<li><a href="../os_mbuf_dup/">os_mbuf_dup</a></li>
+<li><a href="../os_mbuf_extend/">os_mbuf_extend</a></li>
+<li><a href="../os_mbuf_free_chain/">os_mbuf_free_chain</a></li>
+<li><a href="../os_mbuf_get/">os_mbuf_get</a></li>
+<li><a href="../os_mbuf_get_pkthdr/">os_mbuf_get_pkthdr</a></li>
+<li><a href="../os_mbuf_memcmp/">os_mbuf_memcmp</a></li>
+<li><a href="../os_mbuf_off/">os_mbuf_off</a></li>
+<li><a href="../os_mbuf_pool_init/">os_mbuf_pool_init</a></li>
+<li><a href="../os_mbuf_prepend/">os_mbuf_prepend</a></li>
+<li><a href="../os_mbuf_pullup/">os_mbuf_pullup</a></li>
+</ul>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../../heap/os_realloc/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: os_realloc
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../OS_MBUF_PKTHDR/>
+ Next: OS_MBUF_PKTHDR
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+
+ <script src="../../../../js/jquery-1.10.2.min.js"></script>
+ <script src="../../../../js/bootstrap-3.0.3.min.js"></script>
+ <script src="../../../../js/highlight.pack.js"></script>
+ <script src="../../../../js/base.js"></script>
+ <script src="../../../../js/custom.js"></script>
+
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/d18c34dd/develop/os/core_os/mbuf/os_mbuf_adj/index.html
----------------------------------------------------------------------
diff --git a/develop/os/core_os/mbuf/os_mbuf_adj/index.html b/develop/os/core_os/mbuf/os_mbuf_adj/index.html
new file mode 100644
index 0000000..98ddc7a
--- /dev/null
+++ b/develop/os/core_os/mbuf/os_mbuf_adj/index.html
@@ -0,0 +1,967 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+ <link rel="canonical" href="http://mynewt.apache.org/os/core_os/mbuf/os_mbuf_adj/">
+ <link rel="shortcut icon" href="../../../../img/favicon.ico">
+
+ <title>os_mbuf_adj - Apache Mynewt</title>
+
+ <link href="../../../../css/bootstrap-3.0.3.min.css" rel="stylesheet">
+ <link href="../../../../css/font-awesome-4.0.3.css" rel="stylesheet">
+ <link rel="stylesheet" href="../../../../css/highlight.css">
+ <link href="../../../../css/base.css" rel="stylesheet">
+ <link href="../../../../css/custom.css" rel="stylesheet">
+ <link href="../../../../css/v2.css" rel="stylesheet">
+ <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,900,300,100' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link href="../../../../extra.css" rel="stylesheet">
+
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
+ <![endif]-->
+
+
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-72162311-1', 'auto');
+ ga('send', 'pageview');
+ </script>
+
+ </head>
+
+
+ <body class="os_mbuf_adj">
+
+
+
+
+
+
+
+
+
+<nav id="navbar" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+ <div class="container">
+ <!-- Collapsed navigation -->
+ <div class="navbar-header">
+ <!-- Expander button -->
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+
+ </div>
+
+ <!-- Expanded navigation -->
+ <div class="navbar-collapse collapse">
+ <!-- Main navigation -->
+ <ul class="nav navbar-nav navbar-right">
+ <li
+ class=""
+>
+ <a href="/">Home</a>
+ </li>
+ <li
+ class="important"
+>
+ <a href="/quick-start/">Quick Start</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/about/">About</a>
+ </li>
+ <li
+ class="active"
+>
+ <a href="/latest/os/introduction">Documentation</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/download/">Download</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/community/">Community</a>
+ </li>
+ <li
+ class=""
+>
+ <a href="/events/">Events</a>
+ </li>
+ </ul>
+
+ <!-- Search, Navigation and Repo links -->
+ <ul class="nav navbar-nav navbar-right">
+
+ </ul>
+ </div>
+ </div>
+</nav>
+
+
+
+ <div class="container">
+
+ <div class="row">
+ <div class="col-md-3 v2-sidebar"><div id="docSidebar" class="hidden-print" role="complementary">
+ <div class="top">
+ <img class="hidden-xs hidden-sm logo-small" src="/img/logo.svg" alt="MyNewt" title="MyNewt">
+ <div role="search">
+ <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
+ <div class="form-group">
+ <input type="text" name="q" class="form-control" placeholder="Search documentation" />
+ </div>
+ </form>
+ </div>
+ </div>
+ <ul class="toc-nav">
+ <li class="doc-version">
+<select class="form-control" onchange="if (this.value) window.location.href=this.value">
+
+ <option
+ value="/develop/os/introduction"
+ selected="selected"
+ >
+ Version: develop
+ </option>
+
+ <option
+ value="/v0_9_0/os/introduction"
+
+ >
+ Version: 0.9.0 (latest)
+ </option>
+
+</select>
+</li>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <li ><a href="../../../introduction/">Mynewt Documentation</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../../get_started/get_started/">Basic Setup</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../get_started/vocabulary/">Concepts</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../tutorials/tutorials/">Tutorials</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../os_user_guide/">OS User Guide</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li ><a href="../../mynewt_os/">OS Core</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../os_init/
+">System-level Functions</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../context_switch/context_switch/">Scheduler</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../time/os_time/">Time</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../task/task/">Tasks</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../event_queue/event_queue/">Event Queues</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../semaphore/semaphore/">Semaphores</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mutex/mutex/">Mutexes</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../memory_pool/memory_pool/">Memory Pools</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../heap/heap/">Heap</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../mbuf/
+
+">Memory Buffers</a>
+
+
+ <ul>
+
+
+
+
+
+ <li ><a href="../mbuf/">Mbuf</a>
+
+
+ <ul>
+
+
+
+
+
+
+
+ <li><a href="
+ ../OS_MBUF_PKTHDR/
+">Functions/Macros</a>
+
+
+ <ul>
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTHDR/">OS_MBUF_PKTHDR</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTHDR_TO_MBUF/">OS_MBUF_PKTHDR_TO_MBUF</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_PKTLEN/">OS_MBUF_PKTLEN</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_DATA/">OS_MBUF_DATA</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_USRHDR/">OS_MBUF_USRHDR</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_USRHDR_LEN/">OS_MBUF_USRHDR_LEN</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_LEADINGSPACE/">OS_MBUF_LEADINGSPACE</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../OS_MBUF_TRAILINGSPACE/">OS_MBUF_TRAILINGSPACE</a>
+ </li>
+
+
+
+
+
+ <li class="active">
+ <a href="./">os_mbuf_adj</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_append/">os_mbuf_append</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_concat/">os_mbuf_concat</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_copydata/">os_mbuf_copydata</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_copyinto/">os_mbuf_copyinto</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_dup/">os_mbuf_dup</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_extend/">os_mbuf_extend</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_free_chain/">os_mbuf_free_chain</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_get/">os_mbuf_get</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_get_pkthdr/">os_mbuf_get_pkthdr</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_memcmp/">os_mbuf_memcmp</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_off/">os_mbuf_off</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_pool_init/">os_mbuf_pool_init</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_prepend/">os_mbuf_prepend</a>
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../os_mbuf_pullup/">os_mbuf_pullup</a>
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../msys/msys/">Msys</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../mqueue/mqueue/">MQueue</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../sanity/sanity/">Sanity</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../callout/callout/">Callouts</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../porting/port_os/">Porting to your Platform</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/console/console/">Console</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/shell/shell/">Shell</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/bootloader/bootloader/">Bootloader</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+
+
+ ../../../modules/fs/fs/fs/
+
+">File System</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/hal/hal/">Hardware Abstraction Layer</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/testutil/testutil/">Test Utilities</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/imgmgr/imgmgr/">Image Manager</a>
+
+
+ </li>
+
+
+
+
+
+ <li >
+ <a href="../../../modules/baselibc/">Baselibc library</a>
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/elua/elua/">Embedded Lua</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/json/json/">JSON</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/stats/stats/">Stats</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../modules/logs/logs/">Logs</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../network/ble/ble_intro/
+">BLE User Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newt/newt_intro/">Newt Tool Guide</a>
+
+
+ </li>
+
+
+
+
+
+
+
+ <li ><a href="../../../../newtmgr/overview/">Newt Manager Guide</a>
+
+
+ </li>
+
+
+
+ </ul>
+
+ </li>
+
+
+
+
+
+
+
+ <li><a href="
+ ../../../../faq/how_to_edit_docs/
+">Appendix</a>
+
+
+ </li>
+
+
+
+ </ul>
+</div></div>
+
+ <div class="show-sidebar-container">
+ <button class="show-sidebar">Docs Menu</button>
+ </div>
+
+ <div class="col-md-9" role="main">
+ <div class="row doc-header">
+ <div class="col-sm-12">
+ <div role="navigation" aria-label="breadcrumbs navigation">
+ <ul class="wy-breadcrumbs pull-right">
+ <li><a href="/develop/os/introduction">Docs</a></li>
+
+
+
+ <li>» <a href="../mbuf/">Mbuf</a></li>
+
+
+
+ <li>» <a href="../OS_MBUF_PKTHDR/">Functions/Macros</a></li>
+
+
+
+ <li>» os_mbuf_adj</li>
+
+
+
+ </ul>
+</div>
+ </div>
+ </div>
+
+ <h2 id="os_mbuf_adj"><font color="#F2853F" style="font-size:24pt"> os_mbuf_adj</font></h2>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #A90D91">void</span> <span style="color: #000000">os_mbuf_adj</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf</span> <span style="color: #000000">*mp</span>, <span style="color: #A90D91">int</span> <span style="color: #000000">req_len</span>);
+</pre></div>
+
+
+<p>Trims <em>req_len</em> bytes from either the head (if positive) or tail (if negative) of an mbuf chain. Adjusts the packet length of the mbuf chain if <em>mp</em> points to a packet header mbuf. When trimming from the head, no mbufs are freed. When trimming from the tail, any mbufs of zero length left at the end of the chain are freed.</p>
+<p><br></p>
+<h4 id="arguments">Arguments</h4>
+<table>
+<thead>
+<tr>
+<th>Arguments</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>mp</td>
+<td>Pointer to mbuf. Can be head of a chain of mbufs, a single mbuf or a packet header mbuf</td>
+</tr>
+<tr>
+<td>req_len</td>
+<td>Number of bytes to trim from head or tail of mbuf</td>
+</tr>
+</tbody>
+</table>
+<p><br></p>
+<h4 id="returned-values">Returned values</h4>
+<p>None</p>
+<h4 id="notes">Notes</h4>
+<h4 id="example">Example</h4>
+<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> <span style="color: #A90D91">uint16_t</span> <span style="color: #000000">pktlen</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">os_mbuf</span> <span style="color: #000000">*om</span>;
+ <span style="color: #A90D91">struct</span> <span style="color: #000000">my_pkt_header</span> <span style="color: #000000">hdr</span>;
+
+ <span style="color: #177500">/* Get mbuf chain length */</span>
+ <span style="color: #000000">pktlen</span> <span style="color: #000000">=</span> <span style="color: #000000">OS_MBUF_PKTLEN</span>(<span style="color: #000000">om</span>);
+
+ <span style="color: #177500">/* Strip header from mbuf chain */</span>
+ <span style="color: #000000">os_mbuf_adj</span>(<span style="color: #000000">om</span>, <span style="color: #A90D91">sizeof</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">my_pkt_header</span>));
+ <span style="color: #000000">pktlen</span> <span style="color: #000000">-=</span> <span style="color: #A90D91">sizeof</span>(<span style="color: #A90D91">struct</span> <span style="color: #000000">my_pkt_header</span>);
+
+ <span style="color: #177500">/* New packet length should be old packet length minus stripped header */</span>
+ <span style="color: #000000">assert</span>(<span style="color: #000000">pktlen</span> <span style="color: #000000">==</span> <span style="color: #000000">OS_MBUF_PKTLEN</span>(<span style="color: #000000">om</span>));
+</pre></div>
+
+ <div class="row">
+
+
+
+
+<ul class="nav nav-pills" style="margin-bottom: 10px">
+ <li>
+
+ <a href=../OS_MBUF_TRAILINGSPACE/>
+ <span class="fa fa-arrow-left"></span>
+ Previous: OS_MBUF_TRAILINGSPACE
+ </a>
+
+ </li>
+ <li class="pull-right">
+
+ <a href=../os_mbuf_append/>
+ Next: os_mbuf_append
+ <span class="fa fa-arrow-right"></span>
+ </a>
+
+ </li>
+</ul>
+ </div>
+ <div class="row">
+ <footer>
+ <div class="row">
+ <div class="col-md-12">
+
+ <p class="copyright">Copyright © 2015 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 Apache and the Apache feather logo are trademarks of The Apache Software Foundation.<br>The Apache Software Foundation Apache Incubator</p>
+
+ </div>
+ </div>
+ <div class="copyright-logos">
+ <div class="row">
+ <div class="col-xs-6 text-right">
+ <img src="/img/apache-feather.png" alt="Apache" title="Apache">
+ </div>
+ <div class="col-xs-6 text-left">
+ <img src="/img/apache-logo.png" alt="Apache Incubator" title="Apache Incubator">
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <small class="footnote">
+ MyNewt is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+ </small>
+ </div>
+ </div>
+</footer>
+ </div>
+ </div>
+ </div>
+
+
+ </div>
+
+ <script src="../../../../js/jquery-1.10.2.min.js"></script>
+ <script src="../../../../js/bootstrap-3.0.3.min.js"></script>
+ <script src="../../../../js/highlight.pack.js"></script>
+ <script src="../../../../js/base.js"></script>
+ <script src="../../../../js/custom.js"></script>
+
+ </body>
+</html>
\ No newline at end of file