Hello,

I'm attempting to use the network interface for Growl over UDP.  I'm
trying to properly setup the structures for the registration and
messaging packets using C-structs (my main application will be written
in C), but I'm running into some issues where it doesn't seem the
structure is correct ... when I sent a message to the machine's port,
nothing happens.  Here are the two C-structs I'm using, and the
associated functions I'm using to initialize them ... these are right-
now very simple "test" structure just to make sure that I have
everything setup correctly per the diagrams here:

http://growl.info/documentation/developer/protocol.php

... once I know I have the data formatting right, I will then look at
more configurable data structures that can handle multiple messages
and notifications:

#define MESSAGE "This is a test message"
#define APP_NAME "Network_Test"
#define NOTIFICATION_NAME "Test"
#define IP_ADDR "127.0.0.1"
#define PORT 9887

typedef struct reg_message
{
        unsigned char version;
        unsigned char type;
        unsigned short app_name_length;
        unsigned char notification_num;
        unsigned char default_notification_num;
        char application_name[13];
        short notification_length;
        char notification_name[5];
        char defaults[1];
} reg_message;

typedef struct data_message
{
        unsigned char version;
        unsigned char type;
        unsigned short flags;
        unsigned short notification_length;
        unsigned short title_length;
        unsigned short description_length;
        unsigned short application_name_length;
        char notification_name[5];
        char notification_title[13];
        char notification_message[22];
        char application_name[13];
} data_message;


reg_message reg_message_init()
{
        reg_message temp;
        temp.version = 1;
        temp.type = 4;
        temp.app_name_length = 13;
        temp.notification_num = 1;
        temp.default_notification_num = 1;
        temp.notification_length = 5;
        temp.defaults[0] = 5;

        strcpy(temp.application_name, APP_NAME);
        strcpy(temp.notification_name, NOTIFICATION_NAME);

        return temp;
}


data_message data_message_init()
{
        data_message temp;
        temp.version = 1;
        temp.type = 5;
        temp.flags = 0;
        temp.notification_length = 5;
        temp.title_length = 13;
        temp.description_length = 22;
        temp.application_name_length = 13;

        strcpy(temp.notification_name, NOTIFICATION_NAME);
        strcpy(temp.notification_title, APP_NAME);
        strcpy(temp.notification_message, MESSAGE);
        strcpy(temp.application_name, APP_NAME);

        return temp;
}


So did  setup the structures properly?  I know that for packet types 1
and 2, that a checksum is needed, hence to keep things simple at the
moment I'm using the non-authorization types of 4 and 5 which can
supposedly omit the checksum.  From inspecting the Python test code,
it seems that the rest of the structure is setup correctly, although
I'm not sure if my strings are going to be UTF-8 compatible (I think
they will be, but maybe not).

At this point the data-structures are setup little-endian ... I'm not
doing any little-endian-to-big-endian byte swapping when sending these
structures over the network.

Thanks for any tips on how I can set this up so that the structures
are layed-out in memory correctly and initialized correctly if it's
not already correct ... the assumption on my end is that it's not
correct since nothing is happening on the machine I'm sending the
notifications to.

Jason

-- 
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en.

Reply via email to