# How to create a custom header derived from packet\_header\_default.h

**URL:** <https://www.ruby-forum.com/t/how-to-create-a-custom-header-derived-from-packet-header-default-h/231869>\
**Category:** GNU Radio\
**Created:** [September 3, 2014, 5:23pm UTC](https://www.ruby-forum.com/t/how-to-create-a-custom-header-derived-from-packet-header-default-h/231869 "2014-09-03T17:23:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 3, 2014, 5:23pm UTC](https://www.ruby-forum.com/t/how-to-create-a-custom-header-derived-from-packet-header-default-h/231869/1 "2014-09-03T17:23:48Z")

</div>

I am trying to create a custom header format derived from  
packet\_header\_default.h.  
I am also doing this in an out of tree module src structure.

I have successfully got it to compile the c++ code but it now fails  
when I try to add the swig lines into the  
cmake class. I am new to cmake and unclear on how to fix it.

From the python code I get the following message

NameError: packet\_header\_myproject is not define

If someone has an example or a tutorial on this would be great.

From packet\_header\_default.h

- This is a default packet header (see header\_formatter()) for a  
description
- on the header format). To create other header, derive packet header  
creator
- classes from this function.

## Thanks

Andrew

---

<div class="post-metadata">

**Author:** ![Andrew\_Burger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@Andrew\_Burger](https://www.ruby-forum.com/u/Andrew_Burger)\
**Post date:** [September 3, 2014, 5:26pm UTC](https://www.ruby-forum.com/t/how-to-create-a-custom-header-derived-from-packet-header-default-h/231869/2 "2014-09-03T17:26:50Z")

</div>

On 09/03/2014 05:21 PM, Andrew Burger wrote:

> NameError: packet\_header\_myproject is not define
> 
> If someone has an example or a tutorial on this would be great.
> 
> From packet\_header\_default.h
> 
> - This is a default packet header (see header\_formatter()) for a description
> - on the header format). To create other header, derive packet header creator
> - classes from this function.

I did this for my 802.11 module. Maybe it helps

[https://github.com/bastibl/gr-ieee802-11/blob/master/swig/ieee802\_11\_swig.i#L25](https://github.com/bastibl/gr-ieee802-11/blob/master/swig/ieee802_11_swig.i#L25)

Best,  
Bastian

---

<div class="post-metadata">

**Author:** ![Andrew\_Burger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@Andrew\_Burger](https://www.ruby-forum.com/u/Andrew_Burger)\
**Post date:** [September 3, 2014, 6:57pm UTC](https://www.ruby-forum.com/t/how-to-create-a-custom-header-derived-from-packet-header-default-h/231869/3 "2014-09-03T18:57:00Z")

</div>

Make sure you’re publically exporting your symbol (using the  
MYPROJECT\_API macro).

M
