# Structs

### GrowlNetworkNotificationFlags server sends a packet in this format.

Various flags.

>     struct GrowlNetworkNotification {
>         struct GrowlNetworkPacket common;
>         struct GrowlNetworkNotificationFlags {
>             unsigned reserved: 12;
>             signed priority: 3;
>             unsigned sticky: 1;
>             }  flags; //size = 16 (12 + 3 + 1)
>         /* In addition to being unsigned, the notification name length
>      * is in network byte order.
>             */
>         unsigned short nameLen;
>         /* @discussion In addition to being unsigned, the title length is in
>      * network byte order.
>             */
>         unsigned short titleLen;
>         /* In addition to being unsigned, the description length is in
>      * network byte order.
>             */
>         unsigned short descriptionLen;
>         /* In addition to being unsigned, the application name length
>      * is in network byte order.
>             */
>         unsigned short appNameLen;
>         /* The variable-sized data of a notification is:
>      * - Notification name, in UTF-8 encoding, for nameLen bytes.
>      * - Title, in UTF-8 encoding, for titleLen bytes.
>      * - Description, in UTF-8 encoding, for descriptionLen bytes.
>      * - Application name, in UTF-8 encoding, for appNameLen bytes.
>      * - The MD5/SHA256 checksum of all the data preceding the checksum.
>             */
>         unsigned char data[];
>     };

##### Field Descriptions

> `common`
>   The Growl packet header.
> `flags`
>   The priority number and the sticky bit.
> `nameLen`
>   The length of the notification name.
> `titleLen`
>   The length of the notification title.
> `descriptionLen`
>   The length of the notification description.
> `appNameLen`
>   The length of the application name.
> `data`
>   Variable-sized data.
> `reserved`
>   reserved for future use.
> `priority`
>   the priority as a signed 3-bit integer from -2 to +2.
> `sticky`
>   the sticky flag.

##### Discussion

This 16-bit packed structure contains the priority as a signed 3-bit integer from -2 to +2, and the sticky flag as a single bit. The high 12 bits of the structure are reserved for future use.

### GrowlNetworkPacket

This struct is a header common to all incoming Growl network packets which identifies the type and version of the packet.

>     struct GrowlNetworkPacket {
>         unsigned char version;
>         unsigned char type;
>     };

### GrowlNetworkRegistration

The format of a registration packet.

>     struct GrowlNetworkRegistration {
>         struct GrowlNetworkPacket common;
>         /* This name is used both internally and in the Growl
>      * preferences.
>      *
>      * The application name should remain stable between different versions
>      * and incarnations of your application.
>      * For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0"
>      * and "SurfWriter Lite" are not.
>      *
>      * In addition to being unsigned, the application name length is in
>      * network byte order.
>             */
>         unsigned short appNameLen;
>         /* These names are used both internally and in the Growl
>      * preferences. For this reason, they should be human-readable.
>             */
>         unsigned char numAllNotifications;
>         unsigned char numDefaultNotifications;
>         /* The variable-sized data of a registration is:
>      * - The application name, in UTF-8 encoding, for appNameLen bytes.
>      * - The list of all notification names.
>      * - The list of default notifications, as 8-bit unsigned indices into the list of all notifications.
>      * - The MD5/SHA256 checksum of all the data preceding the checksum.
>      *
>      * Each notification name is encoded as:
>      * - Length: two bytes, unsigned, network byte order.
>      * - Name: As many bytes of UTF-8-encoded text as the length says.
>      * And there are numAllNotifications of these.
>             */
>         unsigned char data[];
>     };

##### Field Descriptions

> `common`
>   The Growl packet header.
> `appNameLen`
>   The name of the application that is registering.
> `numAllNotifications`
>   The number of notifications in the list.
> `numDefaultNotifications`
>   The number of notifications in the list that are enabled by default.
> `data`
>   Variable-sized data.

##### Discussion

A Growl client that wants to register with a Growl server sends a packet in this format.

© The Growl Project (Last Updated May 14, 2005)