Sun, 01 Feb 2009 08:25:57 +0000
Move some MSN message handlers from switchboard to general msg.c.
References #7676.
| 2086 | 1 | #ifndef __INTERNAL_H__ |
| 2 | #define __INTERNAL_H__ | |
| 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 | |
| 26 | #endif | |
| 2086 | 27 | |
| 28 | #ifdef ZEPHYR_USES_HESIOD | |
| 29 | #include <hesiod.h> | |
| 30 | #endif | |
| 31 | ||
| 32 | #ifndef ZEPHYR_USES_KERBEROS | |
| 33 | #define REALM_SZ MAXHOSTNAMELEN | |
| 34 | #define INST_SZ 0 /* no instances w/o Kerberos */ | |
| 35 | #define ANAME_SZ 9 /* size of a username + null */ | |
| 36 | #define CLOCK_SKEW 300 /* max time to cache packet ids */ | |
| 37 | #endif | |
| 38 | ||
| 39 | #define SERVER_SVC_FALLBACK htons((unsigned short) 2103) | |
| 40 | #define HM_SVC_FALLBACK htons((unsigned short) 2104) | |
| 41 | #define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105) | |
| 42 | ||
| 43 | #define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */ | |
| 44 | #define ZAUTH_UNSET (-3) /* Internal to client library. */ | |
| 45 | #define Z_MAXFRAGS 500 /* Max number of packet fragments */ | |
| 46 | #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */ | |
| 47 | #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */ | |
| 48 | #define Z_FRAGFUDGE 13 /* Room to for multinotice field */ | |
| 49 | #define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */ | |
| 50 | #define Z_INITFILTERSIZE 30 /* Starting size of uid filter */ | |
| 51 | ||
| 52 | struct _Z_Hole { | |
| 53 | struct _Z_Hole *next; | |
| 54 | int first; | |
| 55 | int last; | |
| 56 | }; | |
| 57 | ||
| 58 | struct _Z_InputQ { | |
| 59 | struct _Z_InputQ *next; | |
| 60 | struct _Z_InputQ *prev; | |
| 61 | ZNotice_Kind_t kind; | |
| 62 | unsigned ZEPHYR_INT32 timep; | |
| 63 | int packet_len; | |
| 64 | char *packet; | |
| 65 | int complete; | |
| 66 | struct sockaddr_in from; | |
| 67 | struct _Z_Hole *holelist; | |
| 68 | ZUnique_Id_t uid; | |
| 69 | int auth; | |
| 70 | int header_len; | |
| 71 | char *header; | |
| 72 | int msg_len; | |
| 73 | char *msg; | |
| 74 | }; | |
| 75 | ||
| 76 | extern struct _Z_InputQ *__Q_Head, *__Q_Tail; | |
| 77 | ||
| 78 | extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */ | |
| 79 | extern int __HM_set; /* 0 if dest addr set, 1 otherwise */ | |
| 80 | extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */ | |
| 81 | ||
| 82 | extern ZLocations_t *__locate_list; | |
| 83 | extern int __locate_num; | |
| 84 | extern int __locate_next; | |
| 85 | ||
| 86 | extern ZSubscription_t *__subscriptions_list; | |
| 87 | extern int __subscriptions_num; | |
| 88 | extern int __subscriptions_next; | |
| 89 | ||
| 90 | extern int __Zephyr_port; /* Port number */ | |
| 2419 | 91 | extern struct in_addr __My_addr; |
| 2086 | 92 | |
| 93 | typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int)); | |
| 94 | ||
| 95 | struct _Z_InputQ *Z_GetFirstComplete __P((void)); | |
| 96 | struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *)); | |
| 97 | Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int)); | |
| 98 | void Z_RemQueue __P((struct _Z_InputQ *)); | |
| 99 | Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int)); | |
| 100 | Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); | |
| 101 | Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); | |
| 102 | Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int, | |
| 103 | int*, char **, char **)); | |
| 104 | Code_t Z_ReadEnqueue __P((void)); | |
| 105 | Code_t Z_ReadWait __P((void)); | |
| 106 | Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*)); | |
| 107 | Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len, | |
| 108 | Z_AuthProc cert_func, | |
| 109 | Z_SendProc send_func)); | |
| 110 | Code_t Z_WaitForComplete __P((void)); | |
| 111 | Code_t Z_WaitForNotice __P((ZNotice_t *notice, | |
| 112 | int (*pred) __P((ZNotice_t *, void *)), void *arg, | |
| 113 | int timeout)); | |
| 114 | ||
| 115 | #endif /* __INTERNAL_H__ */ | |
| 116 |