10 int SkipCertificateCheck
= 0;
11 const char *certificate_filename
= NULL
;
12 const char *tls
= "NORMAL";
14 int exists(const char *filename
__attribute__ ((unused
)))
18 void ProcessPendingEvents(void)
28 int print_info(void *state
__attribute__((unused
)))
37 const char *sequence
[][4] = {
38 {NULL
, NULL
, NULL
, NULL
},
39 {"prefix", " hello", NULL
},
40 {"pre", "fix", " hello", NULL
},
41 {"\r\n", ")\r\n", "prefix", NULL
},
42 {NULL
, NULL
, NULL
, NULL
},
45 /* trick tlscomm into believing it can read. */
46 ssize_t
read(int s
, void *buf
, size_t buflen
)
48 int val
= indices
[s
]++;
50 if (sequence
[s
][val
] == NULL
) {
51 indices
[s
]--; /* make it stay */
54 strncpy(buf
, sequence
[s
][val
], buflen
);
55 printf("read: %s\n", sequence
[s
][val
]);
56 return (strlen(sequence
[s
][val
]));
61 select(int nfds
, fd_set
* r
,
62 fd_set
* w
__attribute__ ((unused
)),
63 fd_set
* x
__attribute__ ((unused
)),
64 struct timeval
*tv
__attribute__ ((unused
)))
68 for (i
= 0; i
< nfds
; i
++) {
69 if (FD_ISSET(i
, r
) && sequence
[i
][indices
[i
]] != NULL
) {
83 struct connection_state
{
86 /*@null@ */ void *tls_state
;
87 /*@null@ */ void *xcred
;
88 char unprocessed
[BUF_SIZE
];
89 void *pc
; /* mailbox handle for debugging messages */
93 main(int argc
__attribute__ ((unused
)), char **argv
94 __attribute__ ((unused
)))
97 struct connection_state scs
;
98 scs
.name
= strdup("test");
99 scs
.unprocessed
[0] = '\0';
101 scs
.tls_state
= NULL
;
105 for (scs
.sd
= 1; sequence
[scs
.sd
][0] != NULL
; scs
.sd
++) {
106 memset(scs
.unprocessed
, 0, BUF_SIZE
);
107 printf("%d\n", tlscomm_expect(&scs
, "prefix", buf
, 255));