1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
4 * Copyright 2002 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
28 * Since fd_set is large on some platforms (8K on AIX 5.2), this probably
29 * shouldn't be allocated in automatic storage. Define USE_POLL and
30 * MAX_POLLFDS in the consumer of this header file to use poll state instead of
35 struct pollfd fds[MAX_POLLFDS];
38 fd_set rfds, wfds, xfds;
41 struct timeval end_time; /* magic: tv_sec==0 => never time out */
45 /* Select state flags. */
47 #define SSF_WRITE 0x02
48 #define SSF_EXCEPTION 0x04
51 static const char *const state_strings[] = {
52 "INITIALIZING", "CONNECTING", "WRITING", "READING", "FAILED"
56 /* connection states */
57 enum conn_states { INITIALIZING, CONNECTING, WRITING, READING, FAILED };
58 struct incoming_krb5_message {
59 size_t bufsizebytes_read;
63 unsigned char bufsizebytes[4];
69 enum conn_states state;
70 unsigned int is_udp : 1;
71 int (*service)(krb5_context context, struct conn_state *,
72 struct select_state *, int);
76 struct sockaddr_storage addr;
82 unsigned char msg_len_buf[4];
84 struct incoming_krb5_message in;
86 krb5_data callback_buffer;
88 struct conn_state *next;
91 struct sendto_callback_info {
92 int (*pfn_callback) (struct conn_state *, void *, krb5_data *);
93 void (*pfn_cleanup) (void *, krb5_data *);
98 krb5_error_code krb5int_cm_call_select (const struct select_state *,
99 struct select_state *, int *);