## idmef-message-write

idmef-message-write — Writing IDMEF class to a message buffer

## Synopsis

    int         idmef_additional_data_write     (idmef_additional_data_t *additional_data,
                                                 prelude_msgbuf_t *msg);
    int         idmef_reference_write           (idmef_reference_t *reference,
                                                 prelude_msgbuf_t *msg);
    int         idmef_classification_write      (idmef_classification_t *classification,
                                                 prelude_msgbuf_t *msg);
    int         idmef_user_id_write             (idmef_user_id_t *user_id,
                                                 prelude_msgbuf_t *msg);
    int         idmef_user_write                (idmef_user_t *user,
                                                 prelude_msgbuf_t *msg);
    int         idmef_address_write             (idmef_address_t *address,
                                                 prelude_msgbuf_t *msg);
    int         idmef_process_write             (idmef_process_t *process,
                                                 prelude_msgbuf_t *msg);
    int         idmef_web_service_write         (idmef_web_service_t *web_service,
                                                 prelude_msgbuf_t *msg);
    int         idmef_snmp_service_write        (idmef_snmp_service_t *snmp_service,
                                                 prelude_msgbuf_t *msg);
    int         idmef_service_write             (idmef_service_t *service,
                                                 prelude_msgbuf_t *msg);
    int         idmef_node_write                (idmef_node_t *node,
                                                 prelude_msgbuf_t *msg);
    int         idmef_source_write              (idmef_source_t *source,
                                                 prelude_msgbuf_t *msg);
    int         idmef_file_access_write         (idmef_file_access_t *file_access,
                                                 prelude_msgbuf_t *msg);
    int         idmef_inode_write               (idmef_inode_t *inode,
                                                 prelude_msgbuf_t *msg);
    int         idmef_checksum_write            (idmef_checksum_t *checksum,
                                                 prelude_msgbuf_t *msg);
    int         idmef_file_write                (idmef_file_t *file,
                                                 prelude_msgbuf_t *msg);
    int         idmef_linkage_write             (idmef_linkage_t *linkage,
                                                 prelude_msgbuf_t *msg);
    int         idmef_target_write              (idmef_target_t *target,
                                                 prelude_msgbuf_t *msg);
    int         idmef_analyzer_write            (idmef_analyzer_t *analyzer,
                                                 prelude_msgbuf_t *msg);
    int         idmef_alertident_write          (idmef_alertident_t *alertident,
                                                 prelude_msgbuf_t *msg);
    int         idmef_impact_write              (idmef_impact_t *impact,
                                                 prelude_msgbuf_t *msg);
    int         idmef_action_write              (idmef_action_t *action,
                                                 prelude_msgbuf_t *msg);
    int         idmef_confidence_write          (idmef_confidence_t *confidence,
                                                 prelude_msgbuf_t *msg);
    int         idmef_assessment_write          (idmef_assessment_t *assessment,
                                                 prelude_msgbuf_t *msg);
    int         idmef_tool_alert_write          (idmef_tool_alert_t *tool_alert,
                                                 prelude_msgbuf_t *msg);
    int         idmef_correlation_alert_write   (idmef_correlation_alert_t *correlation_alert,
                                                 prelude_msgbuf_t *msg);
    int         idmef_overflow_alert_write      (idmef_overflow_alert_t *overflow_alert,
                                                 prelude_msgbuf_t *msg);
    int         idmef_alert_write               (idmef_alert_t *alert,
                                                 prelude_msgbuf_t *msg);
    int         idmef_heartbeat_write           (idmef_heartbeat_t *heartbeat,
                                                 prelude_msgbuf_t *msg);
    int         idmef_message_write             (idmef_message_t *message,
                                                 prelude_msgbuf_t *msg);

## Description

If you're not willing to use the `prelude_client_send_idmef()` function, because for example you want more control over how a message is sent, you can use the idmef-message-write API to send your message manually.

The functions defined in this API all take an IDMEF object as an argument and dump this object in a format suitable for writing it to a socket or a file (covering, for example, convertion from host byte order to network byte order), to the provided prelude_msgbuf_t buffer.

The prelude_msgbuf_t object is just a buffer holding a prelude_msg_t object. When the buffer is full, the user defined function for prelude_msgbuf_t will be called, and the user can write his message using the `prelude_msg_write()` function.

    idmef_message_write(message, msgbuf);

## Details

### idmef_additional_data_write ()

    int         idmef_additional_data_write     (idmef_additional_data_t *additional_data,
                                                 prelude_msgbuf_t *msg);

Write `additional_data` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`additional_data` : | Pointer to a idmef_additional_data_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_reference_write ()

    int         idmef_reference_write           (idmef_reference_t *reference,
                                                 prelude_msgbuf_t *msg);

Write `reference` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`reference` : | Pointer to a idmef_reference_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_classification_write ()

    int         idmef_classification_write      (idmef_classification_t *classification,
                                                 prelude_msgbuf_t *msg);

Write `classification` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`classification` : | Pointer to a idmef_classification_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_user_id_write ()

    int         idmef_user_id_write             (idmef_user_id_t *user_id,
                                                 prelude_msgbuf_t *msg);

Write `user_id` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`user_id` : | Pointer to a idmef_user_id_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_user_write ()

    int         idmef_user_write                (idmef_user_t *user,
                                                 prelude_msgbuf_t *msg);

Write `user` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`user` : | Pointer to a idmef_user_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_address_write ()

    int         idmef_address_write             (idmef_address_t *address,
                                                 prelude_msgbuf_t *msg);

Write `address` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`address` : | Pointer to a idmef_address_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_process_write ()

    int         idmef_process_write             (idmef_process_t *process,
                                                 prelude_msgbuf_t *msg);

Write `process` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`process` : | Pointer to a idmef_process_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_web_service_write ()

    int         idmef_web_service_write         (idmef_web_service_t *web_service,
                                                 prelude_msgbuf_t *msg);

Write `web_service` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`web_service` : | Pointer to a idmef_web_service_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_snmp_service_write ()

    int         idmef_snmp_service_write        (idmef_snmp_service_t *snmp_service,
                                                 prelude_msgbuf_t *msg);

Write `snmp_service` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`snmp_service` : | Pointer to a idmef_snmp_service_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_service_write ()

    int         idmef_service_write             (idmef_service_t *service,
                                                 prelude_msgbuf_t *msg);

Write `service` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`service` : | Pointer to a idmef_service_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_node_write ()

    int         idmef_node_write                (idmef_node_t *node,
                                                 prelude_msgbuf_t *msg);

Write `node` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`node` : | Pointer to a idmef_node_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_source_write ()

    int         idmef_source_write              (idmef_source_t *source,
                                                 prelude_msgbuf_t *msg);

Write `source` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`source` : | Pointer to a idmef_source_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_file_access_write ()

    int         idmef_file_access_write         (idmef_file_access_t *file_access,
                                                 prelude_msgbuf_t *msg);

Write `file_access` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`file_access` : | Pointer to a idmef_file_access_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_inode_write ()

    int         idmef_inode_write               (idmef_inode_t *inode,
                                                 prelude_msgbuf_t *msg);

Write `inode` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`inode` : | Pointer to a idmef_inode_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_checksum_write ()

    int         idmef_checksum_write            (idmef_checksum_t *checksum,
                                                 prelude_msgbuf_t *msg);

Write `checksum` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`checksum` : | Pointer to a idmef_checksum_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_file_write ()

    int         idmef_file_write                (idmef_file_t *file,
                                                 prelude_msgbuf_t *msg);

Write `file` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`file` : | Pointer to a idmef_file_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_linkage_write ()

    int         idmef_linkage_write             (idmef_linkage_t *linkage,
                                                 prelude_msgbuf_t *msg);

Write `linkage` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`linkage` : | Pointer to a idmef_linkage_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_target_write ()

    int         idmef_target_write              (idmef_target_t *target,
                                                 prelude_msgbuf_t *msg);

Write `target` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`target` : | Pointer to a idmef_target_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_analyzer_write ()

    int         idmef_analyzer_write            (idmef_analyzer_t *analyzer,
                                                 prelude_msgbuf_t *msg);

Write `analyzer` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`analyzer` : | Pointer to a idmef_analyzer_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_alertident_write ()

    int         idmef_alertident_write          (idmef_alertident_t *alertident,
                                                 prelude_msgbuf_t *msg);

Write `alertident` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`alertident` : | Pointer to a idmef_alertident_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_impact_write ()

    int         idmef_impact_write              (idmef_impact_t *impact,
                                                 prelude_msgbuf_t *msg);

Write `impact` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`impact` : | Pointer to a idmef_impact_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_action_write ()

    int         idmef_action_write              (idmef_action_t *action,
                                                 prelude_msgbuf_t *msg);

Write `action` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`action` : | Pointer to a idmef_action_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_confidence_write ()

    int         idmef_confidence_write          (idmef_confidence_t *confidence,
                                                 prelude_msgbuf_t *msg);

Write `confidence` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`confidence` : | Pointer to a idmef_confidence_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_assessment_write ()

    int         idmef_assessment_write          (idmef_assessment_t *assessment,
                                                 prelude_msgbuf_t *msg);

Write `assessment` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`assessment` : | Pointer to a idmef_assessment_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_tool_alert_write ()

    int         idmef_tool_alert_write          (idmef_tool_alert_t *tool_alert,
                                                 prelude_msgbuf_t *msg);

Write `tool_alert` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`tool_alert` : | Pointer to a idmef_tool_alert_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_correlation_alert_write ()

    int         idmef_correlation_alert_write   (idmef_correlation_alert_t *correlation_alert,
                                                 prelude_msgbuf_t *msg);

Write `correlation_alert` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`correlation_alert` : | Pointer to a idmef_correlation_alert_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_overflow_alert_write ()

    int         idmef_overflow_alert_write      (idmef_overflow_alert_t *overflow_alert,
                                                 prelude_msgbuf_t *msg);

Write `overflow_alert` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`overflow_alert` : | Pointer to a idmef_overflow_alert_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_alert_write ()

    int         idmef_alert_write               (idmef_alert_t *alert,
                                                 prelude_msgbuf_t *msg);

Write `alert` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`alert` : | Pointer to a idmef_alert_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_heartbeat_write ()

    int         idmef_heartbeat_write           (idmef_heartbeat_t *heartbeat,
                                                 prelude_msgbuf_t *msg);

Write `heartbeat` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`heartbeat` : | Pointer to a idmef_heartbeat_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

### idmef_message_write ()

    int         idmef_message_write             (idmef_message_t *message,
                                                 prelude_msgbuf_t *msg);

Write `message` within `msg` message buffer. The buffer is associated with a prelude_io_t file descriptor where the data will be written.

`message` : | Pointer to a idmef_message_t object.
`msg` : | Pointer to a prelude_msgbuf_t object, where the message should be written.
Returns : | 0 on success, a negative value if an error occured.

## See Also

prelude_msgbuf_t prelude_msg_t