35da32299264c7885691f58dfcaacd2f6c51e4b6
9 int SkipCertificateCheck
= 0;
10 const char *certificate_filename
= NULL
;
11 int exists(const char *filename
__attribute__ ((unused
)))
15 void ProcessPendingEvents(void)
25 int print_info(void *state
__attribute__((unused
)))
34 const char *sequence
[][4] = {
35 {NULL
, NULL
, NULL
, NULL
},
36 {"prefix", " hello", NULL
},
37 {"pre", "fix", " hello", NULL
},
38 {"\r\n", ")\r\n", "prefix", NULL
},
39 {NULL
, NULL
, NULL
, NULL
},
42 /* trick tlscomm into believing it can read. */
43 ssize_t
read(int s
, void *buf
, size_t buflen
)
45 int val
= indices
[s
]++;
47 if (sequence
[s
][val
] == NULL
) {
48 indices
[s
]--; /* make it stay */
51 strncpy(buf
, sequence
[s
][val
], buflen
);
52 printf("read: %s\n", sequence
[s
][val
]);
53 return (strlen(sequence
[s
][val
]));
58 select(int nfds
, fd_set
* r
,
59 fd_set
* w
__attribute__ ((unused
)),
60 fd_set
* x
__attribute__ ((unused
)),
61 struct timeval
*tv
__attribute__ ((unused
)))
65 for (i
= 0; i
< nfds
; i
++) {
66 if (FD_ISSET(i
, r
) && sequence
[i
][indices
[i
]] != NULL
) {
80 struct connection_state
{
83 /*@null@ */ void *tls_state
;
84 /*@null@ */ void *xcred
;
85 char unprocessed
[BUF_SIZE
];
86 void *pc
; /* mailbox handle for debugging messages */
90 main(int argc
__attribute__ ((unused
)), char **argv
91 __attribute__ ((unused
)))
94 struct connection_state scs
;
95 scs
.name
= strdup("test");
96 scs
.unprocessed
[0] = '\0';
102 for (scs
.sd
= 1; sequence
[scs
.sd
][0] != NULL
; scs
.sd
++) {
103 memset(scs
.unprocessed
, 0, BUF_SIZE
);
104 printf("%d\n", tlscomm_expect(&scs
, "prefix", buf
, 255));