the proper term is subnegotiation, not subrequest

This commit is contained in:
Sean Middleditch 2009-03-14 13:06:47 -04:00
parent d30fd57bb2
commit 6b37288ec1
3 changed files with 15 additions and 13 deletions

View File

@ -118,7 +118,7 @@ static void _process(struct libtelnet_t *telnet, unsigned char *buffer,
/* IAC command */
case LIBTELNET_STATE_IAC:
switch (byte) {
/* subrequest */
/* subnegotiation */
case LIBTELNET_SB:
telnet->state = LIBTELNET_STATE_SB;
break;
@ -171,9 +171,9 @@ static void _process(struct libtelnet_t *telnet, unsigned char *buffer,
telnet->state = LIBTELNET_STATE_DATA;
break;
/* subrequest -- buffer bytes until end request */
/* subnegotiation -- buffer bytes until end request */
case LIBTELNET_STATE_SB:
/* IAC command in subrequest -- either IAC SE or IAC IAC */
/* IAC command in subnegotiation -- either IAC SE or IAC IAC */
if (byte == LIBTELNET_IAC) {
telnet->state = LIBTELNET_STATE_SB_IAC;
/* buffer the byte, or bail if we can't */
@ -184,10 +184,10 @@ static void _process(struct libtelnet_t *telnet, unsigned char *buffer,
}
break;
/* IAC escaping inside a subrequest */
/* IAC escaping inside a subnegotiation */
case LIBTELNET_STATE_SB_IAC:
switch (byte) {
/* end subrequest */
/* end subnegotiation */
case LIBTELNET_SE:
/* return to default state */
start = i + 1;
@ -201,7 +201,7 @@ static void _process(struct libtelnet_t *telnet, unsigned char *buffer,
}
/* invoke callback */
libtelnet_subrequest_cb(telnet, telnet->buffer[0],
libtelnet_subnegotiation_cb(telnet, telnet->buffer[0],
telnet->buffer + 1, telnet->length - 1, user_data);
telnet->length = 0;
@ -406,8 +406,9 @@ void libtelnet_send_data(struct libtelnet_t *telnet, unsigned char *buffer,
}
/* send sub-request */
void libtelnet_send_subrequest(struct libtelnet_t *telnet, unsigned char type,
unsigned char *buffer, unsigned int size, void *user_data) {
void libtelnet_send_subnegotiation(struct libtelnet_t *telnet,
unsigned char type, unsigned char *buffer, unsigned int size,
void *user_data) {
libtelnet_send_command(telnet, LIBTELNET_SB, user_data);
libtelnet_send_data(telnet, &type, 1, user_data);
libtelnet_send_data(telnet, buffer, size, user_data);

View File

@ -84,7 +84,7 @@ extern void libtelnet_command_cb(struct libtelnet_t *telnet,
unsigned char cmd, void *user_data);
extern void libtelnet_negotiate_cb(struct libtelnet_t *telnet,
unsigned char cmd, unsigned char opt, void *user_data);
extern void libtelnet_subrequest_cb(struct libtelnet_t *telnet,
extern void libtelnet_subnegotiation_cb(struct libtelnet_t *telnet,
unsigned char type, unsigned char *data, unsigned int size,
void *user_data);
#ifdef HAVE_ZLIB
@ -118,7 +118,7 @@ extern void libtelnet_send_data(struct libtelnet_t *telnet,
unsigned char *buffer, unsigned int size, void *user_data);
/* send sub-request */
extern void libtelnet_send_subrequest(struct libtelnet_t *telnet,
extern void libtelnet_send_subnegotiation(struct libtelnet_t *telnet,
unsigned char type, unsigned char *buffer, unsigned int size,
void *user_data);

View File

@ -185,8 +185,9 @@ void libtelnet_negotiate_cb(struct libtelnet_t *telnet, unsigned char cmd,
conn->remote);
}
void libtelnet_subrequest_cb(struct libtelnet_t *telnet, unsigned char type,
unsigned char *buffer, unsigned int size, void *user_data) {
void libtelnet_subnegotiation_cb(struct libtelnet_t *telnet,
unsigned char type, unsigned char *buffer, unsigned int size,
void *user_data) {
struct conn_t *conn = (struct conn_t*)user_data;
printf("%s SUB %d (%s)", conn->name, (int)type, get_opt(type));
@ -196,7 +197,7 @@ void libtelnet_subrequest_cb(struct libtelnet_t *telnet, unsigned char type,
}
printf("\e[0m\n");
libtelnet_send_subrequest(&conn->remote->telnet, type, buffer, size,
libtelnet_send_subnegotiation(&conn->remote->telnet, type, buffer, size,
conn->remote);
}