Standardize all protocol header guard macros.
[pidgin-git.git] / libpurple / protocols / simple / simple.h
blob4be9788a7c2ce757a87018079dec897433c03c50
1 /**
2 * @file simple.h
4 * purple
6 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef PURPLE_SIMPLE_SIMPLE_H
24 #define PURPLE_SIMPLE_SIMPLE_H
26 #include <glib.h>
27 #include <gmodule.h>
28 #include <gio/gio.h>
29 #include <time.h>
31 #include "circularbuffer.h"
32 #include "network.h"
33 #include "proxy.h"
34 #include "protocol.h"
36 #include "sipmsg.h"
38 #define SIMPLE_BUF_INC 1024
39 #define SIMPLE_REGISTER_RETRY_MAX 2
41 #define SIMPLE_REGISTER_SENT 1
42 #define SIMPLE_REGISTER_RETRY 2
43 #define SIMPLE_REGISTER_COMPLETE 3
45 #define PUBLISH_EXPIRATION 600
46 #define SUBSCRIBE_EXPIRATION 1200
48 #define SIMPLE_TYPE_PROTOCOL (simple_protocol_get_type())
49 #define SIMPLE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocol))
50 #define SIMPLE_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
51 #define SIMPLE_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SIMPLE_TYPE_PROTOCOL))
52 #define SIMPLE_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SIMPLE_TYPE_PROTOCOL))
53 #define SIMPLE_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SIMPLE_TYPE_PROTOCOL, SIMPLEProtocolClass))
55 typedef struct
57 PurpleProtocol parent;
58 } SIMPLEProtocol;
60 typedef struct
62 PurpleProtocolClass parent_class;
63 } SIMPLEProtocolClass;
65 struct sip_dialog {
66 gchar *ourtag;
67 gchar *theirtag;
68 gchar *callid;
71 struct simple_watcher {
72 gchar *name;
73 time_t expire;
74 struct sip_dialog dialog;
75 gboolean needsxpidf;
78 struct simple_buddy {
79 gchar *name;
80 time_t resubscribe;
81 struct sip_dialog *dialog;
84 struct sip_auth {
85 int type; /* 1 = Digest / 2 = NTLM */
86 gchar *nonce;
87 gchar *opaque;
88 gchar *realm;
89 gchar *target;
90 guint32 flags;
91 int nc;
92 gchar *digest_session_key;
93 int retries;
96 struct simple_account_data {
97 PurpleConnection *gc;
98 gchar *servername;
99 gchar *username;
100 gchar *password;
101 GCancellable *cancellable;
102 PurpleNetworkListenData *listen_data;
103 int fd;
104 int cseq;
105 time_t reregister;
106 time_t republish;
107 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */
108 struct sip_auth registrar;
109 struct sip_auth proxy;
110 int listenfd;
111 int listenport;
112 int listenpa;
113 gchar *status;
114 GHashTable *buddies;
115 guint registertimeout;
116 guint resendtimeout;
117 gboolean connecting;
118 PurpleAccount *account;
119 PurpleCircularBuffer *txbuf;
120 guint tx_handler;
121 gchar *regcallid;
122 GSList *transactions;
123 GSList *watcher;
124 GSList *openconns;
125 gboolean udp;
126 struct sockaddr_in serveraddr;
127 int registerexpire;
128 gchar *realhostname;
129 int realport; /* port and hostname from SRV record */
130 gchar *publish_etag;
133 struct sip_connection {
134 int fd;
135 gchar *inbuf;
136 int inbuflen;
137 int inbufused;
138 int inputhandler;
141 struct transaction;
143 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *);
145 struct transaction {
146 time_t time;
147 int retries;
148 int transport; /* 0 = tcp, 1 = udp */
149 int fd;
150 const gchar *cseq;
151 struct sipmsg *msg;
152 TransCallback callback;
155 G_MODULE_EXPORT GType simple_protocol_get_type(void);
157 #endif /* PURPLE_SIMPLE_SIMPLE_H */