Netdude Manual
Prev |  | Next

# nd_protocol

## Name

nd_protocol --

## Synopsis

    #define     ND_PROTO_MAGICS
    enum        ND_ProtocolLayer;
    void        (*ND_ProtoFieldCB)              (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    enum        ND_ProtoFieldType;
    enum        ND_ProtoFieldState;
    ND_Protocol* nd_proto_new                   (LND_Protocol *proto);
    void        nd_proto_free                   (LND_Protocol *proto);
    ND_Protocol* nd_proto_get                   (const LND_Protocol *proto);
    void        nd_proto_field_set              (const LND_ProtoInfo *pinf,
                                                 ND_ProtoField *field,
                                                 void *data);
    void        nd_proto_field_set_for_menu     (const LND_ProtoInfo *pinf,
                                                 ND_ProtoField *field,
                                                 void *data,
                                                 ND_MenuData *menu,
                                                 char *alt_form_str);
    const char* nd_proto_field_to_string        (const ND_ProtoField *field);
    char*       nd_proto_get_opt_key            (LND_Protocol *proto);
    void        nd_proto_4bit_hi_cb             (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    void        nd_proto_4bit_lo_cb             (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    void        nd_proto_8bit_cb                (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    void        nd_proto_16bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    void        nd_proto_24bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    void        nd_proto_32bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);
    enum        ND_ProtoCallbackMode;
    ND_ProtoCallbackData* nd_proto_cb_data_new  (LND_Protocol *proto,
                                                 guchar *data,
                                                 guint offset,
                                                 gboolean update_packet);
    void        nd_proto_cb_data_free           (ND_ProtoCallbackData *cb_data);
    void        nd_proto_iterate_4bit_hi_cb     (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);
    void        nd_proto_iterate_4bit_lo_cb     (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);
    void        nd_proto_iterate_8bit_cb        (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);
    void        nd_proto_iterate_16bit_cb       (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);
    void        nd_proto_iterate_32bit_cb       (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);
    #define     DATA_TO_PTR                     (data)

## Description

## Details

### ND_PROTO_MAGICS

    #define ND_PROTO_MAGICS 3

### enum ND_ProtocolLayer

    typedef enum {
      ND_PROTO_LAYER_LINK  = (1 << 0),
      ND_PROTO_LAYER_NET   = (1 << 1),
      ND_PROTO_LAYER_TRANS = (1 << 2),
      ND_PROTO_LAYER_APP   = (1 << 3)
    } ND_ProtocolLayer;

### ND_ProtoFieldCB ()

    void        (*ND_ProtoFieldCB)              (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### enum ND_ProtoFieldType

    typedef enum
    {
      ND_VAL_FIELD,
      ND_FLG_FIELD

    } ND_ProtoFieldType;

### enum ND_ProtoFieldState

    typedef enum
    {
      ND_FIELD_STATE_NORMAL,
      ND_FIELD_STATE_UNKN,
      ND_FIELD_STATE_ERROR

    } ND_ProtoFieldState;

### nd_proto_new ()

    ND_Protocol* nd_proto_new                   (LND_Protocol *proto);

`proto` :

Returns :

### nd_proto_free ()

    void        nd_proto_free                   (LND_Protocol *proto);

`proto` :

### nd_proto_get ()

    ND_Protocol* nd_proto_get                   (const LND_Protocol *proto);

`proto` :

Returns :

### nd_proto_field_set ()

    void        nd_proto_field_set              (const LND_ProtoInfo *pinf,
                                                 ND_ProtoField *field,
                                                 void *data);

`pinf` :

`field` :

`data` :

### nd_proto_field_set_for_menu ()

    void        nd_proto_field_set_for_menu     (const LND_ProtoInfo *pinf,
                                                 ND_ProtoField *field,
                                                 void *data,
                                                 ND_MenuData *menu,
                                                 char *alt_form_str);

`pinf` :

`field` :

`data` :

`menu` :

`alt_form_str` :

### nd_proto_field_to_string ()

    const char* nd_proto_field_to_string        (const ND_ProtoField *field);

`field` :

Returns :

### nd_proto_get_opt_key ()

    char*       nd_proto_get_opt_key            (LND_Protocol *proto);

`proto` :

Returns :

### nd_proto_4bit_hi_cb ()

    void        nd_proto_4bit_hi_cb             (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### nd_proto_4bit_lo_cb ()

    void        nd_proto_4bit_lo_cb             (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### nd_proto_8bit_cb ()

    void        nd_proto_8bit_cb                (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### nd_proto_16bit_cb ()

    void        nd_proto_16bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### nd_proto_24bit_cb ()

    void        nd_proto_24bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### nd_proto_32bit_cb ()

    void        nd_proto_32bit_cb               (LND_Packet *packet,
                                                 guchar *header,
                                                 guchar *data);

`packet` :

`header` :

`data` :

### enum ND_ProtoCallbackMode

    typedef enum {
      ND_PROT_CB_4LO,
      ND_PROT_CB_4HI,
      ND_PROT_CB_8,
      ND_PROT_CB_16,
      ND_PROT_CB_32
    } ND_ProtoCallbackMode;

### nd_proto_cb_data_new ()

    ND_ProtoCallbackData* nd_proto_cb_data_new  (LND_Protocol *proto,
                                                 guchar *data,
                                                 guint offset,
                                                 gboolean update_packet);

This function creates a helper data structure that gets passed to the iterating callbacks (`nd_proto_iterate_8bit_cb()` and friends).

`proto` :

  protocol to use in callback

`data` :

  data pointer to protocol header

`offset` :

  offset of the affected field in bytes from start of header

`update_packet` :

  whether to call `nd_packet_update()` for each modified packet.

Returns :

  new callback data structure, or NULL if allocation failed.

### nd_proto_cb_data_free ()

    void        nd_proto_cb_data_free           (ND_ProtoCallbackData *cb_data);

`cb_data` :

### nd_proto_iterate_4bit_hi_cb ()

    void        nd_proto_iterate_4bit_hi_cb     (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);

`packet` :

`user_data` :

`value` :

### nd_proto_iterate_4bit_lo_cb ()

    void        nd_proto_iterate_4bit_lo_cb     (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);

`packet` :

`user_data` :

`value` :

### nd_proto_iterate_8bit_cb ()

    void        nd_proto_iterate_8bit_cb        (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);

`packet` :

`user_data` :

`value` :

### nd_proto_iterate_16bit_cb ()

    void        nd_proto_iterate_16bit_cb       (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);

`packet` :

`user_data` :

`value` :

### nd_proto_iterate_32bit_cb ()

    void        nd_proto_iterate_32bit_cb       (LND_Packet *packet,
                                                 void *user_data,
                                                 guint value);

`packet` :

`user_data` :

`value` :

### DATA_TO_PTR()

    #define DATA_TO_PTR(data) (GINT_TO_POINTER((gint) (data)))

`data` :

Prev | Home | Next
nd_prefs | Up | nd_protocol_inst