From 1fc58c8aaf157418ef1a6706717be0f2956a4ecf Mon Sep 17 00:00:00 2001
From: kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>
Date: Sat, 6 Jun 2009 16:04:59 +0000
Subject:  - move code of innbbsd/str_decode.c to cmsys/string.c

git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4499 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
---
 include/cmsys.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

(limited to 'include')

diff --git a/include/cmsys.h b/include/cmsys.h
index 2b90042c..1b2b4f4e 100644
--- a/include/cmsys.h
+++ b/include/cmsys.h
@@ -104,6 +104,14 @@ extern unsigned StringHash(const char *s);
 extern int    DBCS_RemoveIntrEscape(unsigned char *buf, int *len);
 extern int    DBCS_Status(const char *dbcstr, int pos);
 extern char * DBCS_strcasestr(const char* pool, const char *ptr);
+extern size_t str_iconv(
+	  const char *fromcode,	/* charset of source string */
+	  const char *tocode,	/* charset of destination string */
+	  const char *src,	/* source string */
+	  size_t srclen,		/* source string length */
+	  char *dst,		/* destination string */
+	  size_t dstlen);
+extern void str_decode_M3(unsigned char *str);
 
 /* time.c */
 extern int is_leap_year(int year);
@@ -166,4 +174,33 @@ extern void Vector_sublist(const struct Vector *src, struct Vector *dst, const c
 extern int Vector_remove(struct Vector *self, const char *name);
 extern int Vector_search(const struct Vector *self, const char *name);
 
+/* telnet.c */
+struct TelnetCallback {
+    void (*term_resize)(int w, int h);
+    void (*update_client_code)(void *ccctx, unsigned char seq);
+};
+#define TELNET_IAC_MAXLEN (16)
+
+struct TelnetCtx {
+    int fd;		// should be blocking fd
+    unsigned char iac_state;
+    
+    unsigned char iac_quote;
+    unsigned char iac_opt_req;
+
+    unsigned char iac_buf[TELNET_IAC_MAXLEN];
+    unsigned int  iac_buflen;
+
+    const struct TelnetCallback *callback;
+    void *ccctx;	// client code detection contex
+};
+typedef struct TelnetCtx TelnetCtx;
+
+extern TelnetCtx *telnet_create_contex(void);
+extern void telnet_ctx_init(TelnetCtx *ctx, const struct TelnetCallback *callback, int fd);
+extern void telnet_ctx_set_ccctx(TelnetCtx *ctx, void *ccctx);
+
+extern void telnet_send_init_cmds(int fd);
+extern ssize_t telnet_process(TelnetCtx *ctx, unsigned char *buf, size_t size);
+
 #endif
-- 
cgit v1.2.3