Tue, 05 Nov 2019 21:07:41 -0500
Add some NULL checks to silence scan-build.
|
39819
3554dac2991b
Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34304
diff
changeset
|
1 | #ifndef PURPLE_ZEPHYR_INTERNAL_H |
|
3554dac2991b
Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34304
diff
changeset
|
2 | #define PURPLE_ZEPHYR_INTERNAL_H |
| 2086 | 3 | |
| 4 | #include <sysdep.h> | |
| 10867 | 5 | |
|
23315
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
6 | #ifdef LIBZEPHYR_EXT |
|
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
7 | #include <zephyr/zephyr.h> |
|
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | #else |
|
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
9 | #include <zephyr_internal.h> |
|
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
10 | #endif |
|
934db4b32b9f
When compiling against an external libzephyr, we need to use its zephyr.h,
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
11 | |
| 10867 | 12 | #ifndef WIN32 |
| 2086 | 13 | #include <netdb.h> |
| 10867 | 14 | #endif |
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | #ifdef WIN32 | |
| 19 | ||
| 20 | #ifndef MAXHOSTNAMELEN | |
| 21 | #define MAXHOSTNAMELEN 512 | |
| 22 | #endif | |
| 23 | ||
| 24 | #define ETIMEDOUT WSAETIMEDOUT | |
| 25 | #define EADDRINUSE WSAEADDRINUSE | |
|
28067
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
26 | #else /* !WIN32 */ |
|
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
27 | |
|
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
28 | #ifndef MAXHOSTNAMELEN |
|
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
29 | #define MAXHOSTNAMELEN 4096 |
|
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
30 | #endif |
|
086aa4d8d4a4
zephyr: Build properly on Hurd.
Marc Dequènes <duck@hurdfr.org>
parents:
23315
diff
changeset
|
31 | |
| 10867 | 32 | #endif |
| 2086 | 33 | |
| 34 | #ifdef ZEPHYR_USES_HESIOD | |
| 35 | #include <hesiod.h> | |
| 36 | #endif | |
| 37 | ||
| 38 | #ifndef ZEPHYR_USES_KERBEROS | |
| 39 | #define REALM_SZ MAXHOSTNAMELEN | |
| 40 | #define INST_SZ 0 /* no instances w/o Kerberos */ | |
| 41 | #define ANAME_SZ 9 /* size of a username + null */ | |
| 42 | #define CLOCK_SKEW 300 /* max time to cache packet ids */ | |
| 43 | #endif | |
| 44 | ||
| 45 | #define SERVER_SVC_FALLBACK htons((unsigned short) 2103) | |
| 46 | #define HM_SVC_FALLBACK htons((unsigned short) 2104) | |
| 47 | #define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105) | |
| 48 | ||
| 49 | #define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */ | |
| 50 | #define ZAUTH_UNSET (-3) /* Internal to client library. */ | |
| 51 | #define Z_MAXFRAGS 500 /* Max number of packet fragments */ | |
| 52 | #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */ | |
| 53 | #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */ | |
| 54 | #define Z_FRAGFUDGE 13 /* Room to for multinotice field */ | |
| 55 | #define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */ | |
| 56 | #define Z_INITFILTERSIZE 30 /* Starting size of uid filter */ | |
| 57 | ||
| 58 | struct _Z_Hole { | |
| 59 | struct _Z_Hole *next; | |
| 60 | int first; | |
| 61 | int last; | |
| 62 | }; | |
| 63 | ||
| 64 | struct _Z_InputQ { | |
| 65 | struct _Z_InputQ *next; | |
| 66 | struct _Z_InputQ *prev; | |
| 67 | ZNotice_Kind_t kind; | |
| 68 | unsigned ZEPHYR_INT32 timep; | |
| 69 | int packet_len; | |
| 70 | char *packet; | |
| 71 | int complete; | |
| 72 | struct sockaddr_in from; | |
| 73 | struct _Z_Hole *holelist; | |
| 74 | ZUnique_Id_t uid; | |
| 75 | int auth; | |
| 76 | int header_len; | |
| 77 | char *header; | |
| 78 | int msg_len; | |
| 79 | char *msg; | |
| 80 | }; | |
| 81 | ||
| 82 | extern struct _Z_InputQ *__Q_Head, *__Q_Tail; | |
| 83 | ||
| 84 | extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */ | |
| 85 | extern int __HM_set; /* 0 if dest addr set, 1 otherwise */ | |
| 86 | extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */ | |
| 87 | ||
| 88 | extern ZLocations_t *__locate_list; | |
| 89 | extern int __locate_num; | |
| 90 | extern int __locate_next; | |
| 91 | ||
| 92 | extern ZSubscription_t *__subscriptions_list; | |
| 93 | extern int __subscriptions_num; | |
| 94 | extern int __subscriptions_next; | |
| 95 | ||
| 96 | extern int __Zephyr_port; /* Port number */ | |
| 2419 | 97 | extern struct in_addr __My_addr; |
| 2086 | 98 | |
|
39829
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
99 | typedef Code_t (*Z_SendProc)(ZNotice_t *, char *, int, int); |
| 2086 | 100 | |
|
39829
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
101 | struct _Z_InputQ *Z_GetFirstComplete(void); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
102 | struct _Z_InputQ *Z_GetNextComplete(struct _Z_InputQ *); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
103 | Code_t Z_XmitFragment(ZNotice_t *, char *, int, int); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
104 | void Z_RemQueue(struct _Z_InputQ *); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
105 | Code_t Z_AddNoticeToEntry(struct _Z_InputQ *, ZNotice_t *, int); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
106 | Code_t Z_FormatAuthHeader(ZNotice_t *, char *, int, int *, Z_AuthProc); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
107 | Code_t Z_FormatHeader(ZNotice_t *, char *, int, int *, Z_AuthProc); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
108 | Code_t Z_FormatRawHeader(ZNotice_t *, char *, gsize, int *, char **, char **); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
109 | Code_t Z_ReadEnqueue(void); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
110 | Code_t Z_ReadWait(void); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
111 | Code_t Z_SendLocation(char *, char *, Z_AuthProc, char *); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
112 | Code_t Z_SendFragmentedNotice(ZNotice_t *notice, int len, Z_AuthProc cert_func, |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
113 | Z_SendProc send_func); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
114 | Code_t Z_WaitForComplete(void); |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
115 | Code_t Z_WaitForNotice(ZNotice_t *notice, int (*pred)(ZNotice_t *, void *), |
|
ce056c64e426
zephyr: Remove support for compilers without __STDC__.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39819
diff
changeset
|
116 | void *arg, int timeout); |
| 2086 | 117 | |
|
39819
3554dac2991b
Standardize all protocol header guard macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34304
diff
changeset
|
118 | #endif /* PURPLE_ZEPHYR_INTERNAL_H */ |