summaryrefslogtreecommitdiff
path: root/pn_node.h
blob: 830d47255527911a366910b0431bb8f1874ff4ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef PN_NODE_H
#define PN_NODE_H

#include <glib-object.h>

#include <stdbool.h>

struct pn_node {
	GObject parent;

	struct pn_node_priv *priv;
};

struct pn_node_class {
	GObjectClass parent_class;

	void (*connect) (struct pn_node *node, const char *hostname, int port);
	void (*close) (struct pn_node *node);
	void (*write) (struct pn_node *node, const void *buffer, gsize count);

	guint open_sig;
	guint error_sig;
};

#define PN_NODE_TYPE (pn_node_get_type())
#define PN_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PN_NODE_TYPE, struct pn_node))
#define PN_NODE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), PN_NODE_TYPE, struct pn_node_class))
#define PN_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PN_NODE_TYPE, struct pn_node_class))

struct pn_node *pn_node_new(void);
void pn_node_free(struct pn_node *node);
void pn_node_connect(struct pn_node *node, const char *hostname, int port);
void pn_node_close(struct pn_node *node);

void pn_node_write(struct pn_node *node, const void *buffer, gsize count);

GType pn_node_get_type(void);

#endif /* PN_NODE_H */