loudmouth/lm-message-node.h
author Frank Zschockelt <lm@freakysoft.de>
Sat, 11 May 2019 22:25:49 +0200
changeset 738 264fece7ff0d
parent 710 ea3137a59c2b
permissions -rw-r--r--
Fix getaddrinfo() handling in blocking resolver If getaddrinfo() fails, the first call setting the result will already free the resolver. Trying to access it afterwards will lead to a warning to the console from glib. getaddrinfo() shouldn't return NULL for the result list if it returns successful.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
516
4dd3aa6b83e5 Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents: 515
diff changeset
     1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     2
/*
99
81e9d035de02 2004-10-05 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 84
diff changeset
     3
 * Copyright (C) 2003 Imendio AB
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     4
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     9
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    14
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
690
7ccf2113ec5f Update the postal address of the FSF
Frank Zschockelt <lm@freakysoft.de>
parents: 607
diff changeset
    16
 * License along with this program; if not, see <https://www.gnu.org/licenses>
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    17
 */
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    18
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    19
#ifndef __LM_MESSAGE_NODE_H__
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    20
#define __LM_MESSAGE_NODE_H__
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    21
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    22
#if !defined (LM_INSIDE_LOUDMOUTH_H) && !defined (LM_COMPILATION)
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    23
#error "Only <loudmouth/loudmouth.h> can be included directly, this file may disappear or change contents."
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    24
#endif
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    25
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    26
#include <glib.h>
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    27
101
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    28
G_BEGIN_DECLS
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    29
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    30
/**
710
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    31
 * LmMessageNodeAttribute:
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    32
 * @name: attribute name
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    33
 * @value: attribute value
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    34
 * @next: next attribute
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    35
 *
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    36
 * Linked list of message node attributes.
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    37
 */
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    38
typedef struct _LmMessageNodeAttribute LmMessageNodeAttribute;
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    39
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    40
struct _LmMessageNodeAttribute {
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    41
    gchar *name;
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    42
    gchar *value;
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    43
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    44
    LmMessageNodeAttribute *next;
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    45
};
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    46
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    47
/**
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    48
 * LmMessageNode:
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    49
 * @name: the name of the node
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    50
 * @value: value of the node, can be NULL
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    51
 * @raw_mode: if true, don't escape the content of the message. The content must be valid XML.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    52
 * @next: next sibling
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    53
 * @prev: previous sibling
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    54
 * @parent: node parent
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    55
 * @children: pointing to first child
710
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    56
 * @attributes: linked list of node attributes
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 518
diff changeset
    57
 *
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 518
diff changeset
    58
 * A struct representing a node in a message.
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 101
diff changeset
    59
 */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    60
typedef struct _LmMessageNode LmMessageNode;
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    61
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    62
struct _LmMessageNode {
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    63
    gchar      *name;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    64
    gchar      *value;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    65
    gboolean    raw_mode;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    66
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    67
    LmMessageNode     *next;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    68
    LmMessageNode     *prev;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    69
    LmMessageNode     *parent;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    70
    LmMessageNode     *children;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    71
710
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    72
    LmMessageNodeAttribute *attributes;
ea3137a59c2b LmMessageNode: Expose attributes member
Mykhailo Danylenko <risbea@gmail.com>
parents: 690
diff changeset
    73
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    74
    /* < private > */
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    75
    gint        ref_count;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    76
};
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    77
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    78
const gchar *  lm_message_node_get_value      (LmMessageNode *node);
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    79
void           lm_message_node_set_value      (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    80
                                               const gchar   *value);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    81
LmMessageNode *lm_message_node_add_child      (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    82
                                               const gchar   *name,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    83
                                               const gchar   *value);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    84
void           lm_message_node_set_attributes (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    85
                                               const gchar   *name,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    86
                                               ...);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    87
void           lm_message_node_set_attribute  (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    88
                                               const gchar   *name,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    89
                                               const gchar   *value);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    90
const gchar *  lm_message_node_get_attribute  (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    91
                                               const gchar   *name);
56
3bf928955fc5 2003-11-20 Ross Burton <ross@burtonini.com>
hallski <hallski>
parents: 7
diff changeset
    92
LmMessageNode *lm_message_node_get_child      (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    93
                                               const gchar   *child_name);
56
3bf928955fc5 2003-11-20 Ross Burton <ross@burtonini.com>
hallski <hallski>
parents: 7
diff changeset
    94
LmMessageNode *lm_message_node_find_child     (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    95
                                               const gchar   *child_name);
6
78fdf5d9eb1b 2003-06-11 Mikael Hallendal <micke@codefactory.se>
hallski <hallski>
parents: 4
diff changeset
    96
gboolean       lm_message_node_get_raw_mode   (LmMessageNode *node);
78fdf5d9eb1b 2003-06-11 Mikael Hallendal <micke@codefactory.se>
hallski <hallski>
parents: 4
diff changeset
    97
void           lm_message_node_set_raw_mode   (LmMessageNode *node,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    98
                                               gboolean       raw_mode);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    99
LmMessageNode *lm_message_node_ref            (LmMessageNode *node);
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   100
void           lm_message_node_unref          (LmMessageNode *node);
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   101
gchar *        lm_message_node_to_string      (LmMessageNode *node);
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   102
101
a8abfbc8c005 2004-10-22 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
   103
G_END_DECLS
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   104
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   105
#endif /* __LM_MESSAGE_NODE_H__ */