Fri, 11 Dec 2020 04:12:45 -0600
Convert zephyr to gio
Remove `SO_BSDCOMPAT` which has been obsolete for 15+ years.
Remove unused `from` parameter in ZCheckAuthorization.
Make `zuid_addr` into its plain integral type, not `struct in_addr`.
Make `__HM_addr` into a `GSocketAddress`.
Use `GSocketAddress` for `Z_InputQ->from`.
Make `__My_addr` a `guint32` instead of `struct in_addr`.
Change `__Zephyr_port` into a `gint`.
Convert zephyr to `GSocket`.
Remove `hostaddr` argument to `ZhmStat`, as it's always `NULL`.
Use gio to determine self-address.
Use gio to print out bad packet information.
Cleanup remaining indents.
Testing Done:
compile only
Reviewed at https://reviews.imfreedom.org/r/261/
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZIfNotice function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | * "mit-copyright.h". |
| 2086 | 9 | */ |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39829
diff
changeset
|
13 | Code_t |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40628
diff
changeset
|
14 | ZIfNotice(ZNotice_t *notice, GSocketAddress **from, |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39829
diff
changeset
|
15 | int (*predicate)(ZNotice_t *, void *), void *args) |
| 2086 | 16 | { |
| 17 | ZNotice_t tmpnotice; | |
| 18 | Code_t retval; | |
| 19 | char *buffer; | |
|
40628
4266008a7791
Use a GQueue for zephyr plus related cleanup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40166
diff
changeset
|
20 | Z_InputQ *qptr; |
| 2086 | 21 | |
| 22 | if ((retval = Z_WaitForComplete()) != ZERR_NONE) | |
| 23 | return (retval); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
24 | |
| 2086 | 25 | qptr = Z_GetFirstComplete(); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
26 | |
| 2086 | 27 | for (;;) { |
| 28 | while (qptr) { | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
29 | if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, |
| 2086 | 30 | &tmpnotice)) != ZERR_NONE) |
| 31 | return (retval); | |
| 32 | if ((*predicate)(&tmpnotice, args)) { | |
| 33 | if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) | |
| 34 | return (ENOMEM); | |
| 35 | (void) memcpy(buffer, qptr->packet, qptr->packet_len); | |
|
40643
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40628
diff
changeset
|
36 | if (from) { |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40628
diff
changeset
|
37 | *from = g_object_ref(qptr->from); |
|
1c9bdf8d3e85
Convert zephyr to gio
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40628
diff
changeset
|
38 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
39 | if ((retval = ZParseNotice(buffer, qptr->packet_len, |
| 2086 | 40 | notice)) != ZERR_NONE) { |
| 41 | free(buffer); | |
| 42 | return (retval); | |
| 43 | } | |
| 44 | Z_RemQueue(qptr); | |
| 45 | return (ZERR_NONE); | |
| 46 | } | |
| 47 | qptr = Z_GetNextComplete(qptr); | |
| 48 | } | |
| 49 | if ((retval = Z_ReadWait()) != ZERR_NONE) | |
| 50 | return (retval); | |
| 51 | qptr = Z_GetFirstComplete(); /* need to look over all of | |
| 52 | the queued messages, in case | |
| 53 | a fragment has been reassembled */ | |
| 54 | } | |
| 55 | } |