Mercurial > pidgin
annotate src/multi.h @ 8436:4bb3d8dc717e
[gaim-migrate @ 9166]
" If getaddrinfo() is used, the addrlen and addr returned
through that function are written through the pipe to
the child Gaim processes. getaddrinfo() sets the
addrlen and addr fields through the following
structure, defined in <netdb.h>:
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
This is from FreeBSD/amd64 5.2.1-RELEASE. This
structure is defined differently on different systems.
Take, for example, this OpenBSD/i386 3.5-beta system:
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
After being read, the addrlen and addr of each host is
written through the descriptor:
src/proxy.c:
466 rc =
getaddrinfo(dns_params.hostname, servname, &hints, &res);
...
478 while(res) {
479
write(child_out[1], &(res->ai_addrlen),
sizeof(res->ai_addrlen));
480
write(child_out[1], res->ai_addr, res->ai_addrlen);
481 res =
res->ai_next;
482 }
And later subsequently read:
286 rc=read(req->fd_out,
&addrlen, sizeof(addrlen));
287 if(rc>0 && addrlen > 0) {
288
addr=g_malloc(addrlen);
289
rc=read(req->fd_out, addr, addrlen);
So hence, the type of addrlen that is used in
host_resolved() must match that of the addrlen used in
the addrinfo structure, or they must at least be
guarenteed to be the same size." --jarady
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Fri, 12 Mar 2004 16:59:22 +0000 |
| parents | 9d1a984681fe |
| children | 5af95c2b1179 |
| rev | line source |
|---|---|
| 960 | 1 /* |
| 2 * gaim | |
| 3 * | |
| 8046 | 4 * Gaim is the legal property of its developers, whose names are too numerous |
| 5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 6 * source distribution. | |
| 960 | 7 * |
| 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. | |
| 12 * | |
| 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. | |
| 17 * | |
| 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 * | |
| 22 */ | |
| 23 | |
|
2417
5473c8c5378d
[gaim-migrate @ 2430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2402
diff
changeset
|
24 #ifndef _MULTI_H_ |
|
5473c8c5378d
[gaim-migrate @ 2430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2402
diff
changeset
|
25 #define _MULTI_H_ |
| 960 | 26 |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5469
diff
changeset
|
27 #include "account.h" |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
28 #include "plugin.h" |
| 960 | 29 |
| 4333 | 30 struct proto_actions_menu { |
| 31 char *label; | |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5469
diff
changeset
|
32 void (*callback)(GaimConnection *); |
|
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5469
diff
changeset
|
33 GaimConnection *gc; |
| 4333 | 34 }; |
| 35 | |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
36 struct proto_buddy_menu { |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
37 char *label; |
|
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5469
diff
changeset
|
38 void (*callback)(GaimConnection *, const char *); |
|
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5469
diff
changeset
|
39 GaimConnection *gc; |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
40 }; |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2154
diff
changeset
|
41 |
|
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
42 struct proto_chat_entry { |
|
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
43 char *label; |
| 5234 | 44 char *identifier; |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2204
diff
changeset
|
45 char *def; |
|
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
46 gboolean is_int; |
|
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
47 int min; |
|
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
48 int max; |
| 5925 | 49 gboolean secret; |
|
2204
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
50 }; |
|
5014b802eb41
[gaim-migrate @ 2214]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
51 |
| 8170 | 52 struct proto_pref { |
| 53 char *key; | |
| 54 char *label; | |
| 55 int min; | |
| 56 int max; | |
| 57 }; | |
| 58 | |
|
2417
5473c8c5378d
[gaim-migrate @ 2430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2402
diff
changeset
|
59 #endif /* _MULTI_H_ */ |
|
5910
211760926728
[gaim-migrate @ 6342]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
60 |
|
211760926728
[gaim-migrate @ 6342]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
61 /* A big line. */ |
|
211760926728
[gaim-migrate @ 6342]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
62 /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ |
