aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-09-11 14:12:00 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-09-11 14:12:00 +0800
commitde142cc23c2635c9aab8f47a9014372554cb2281 (patch)
treee1b6ee7aeebe03ea50fb234ee41361cc6895c781
parent1070089e9005d7d7dc9dc4500a0e95c0e47b27a1 (diff)
OsmoVTY: Add low level VTY code.
-rw-r--r--OsmoVTY.st49
1 files changed, 49 insertions, 0 deletions
diff --git a/OsmoVTY.st b/OsmoVTY.st
new file mode 100644
index 0000000..0a9e3e1
--- /dev/null
+++ b/OsmoVTY.st
@@ -0,0 +1,49 @@
+"Copyright placeholder"
+
+CStruct subclass: vty_app_info [
+ <comment: 'I represent the vty_app_info... some structs are wrong'>
+ <declaration: #(
+ (#name #string)
+ (#version #string)
+ (#copyright #string)
+ (#tall_ctx (#ptr #int))
+ (#go_parent_cb (#ptr #int))
+ (#is_config_node (#ptr #int))) >
+]
+
+Object subclass: OSMOVTY [
+ <comment: 'I provide access to the VTY code'>
+ <category: 'libosmovty'>
+
+ OSMOVTY class >> initialize [
+ DLD addLibrary: 'libosmovty.so.0'
+ ]
+
+ OSMOVTY class >> vty_init: app_info [
+ <cCall: 'vty_init' returning: #void args: #(#cObject) >
+ ]
+
+ OSMOVTY class >> vty_read_config_file: file_name priv: priv [
+ <cCall: 'vty_read_config_file' returning: #int args: #(#string (#ptr #long)) >
+ ]
+
+ OSMOVTY class >> telnet_init: tall_context priv: priv port: aPort [
+ <cCall: 'telnet_init' returning: #int args: #(#cObject #cObject #int) >
+ ]
+]
+
+Eval [
+ | app_info |
+
+ OSMOVTY initialize.
+
+ app_info := vty_app_info gcNew.
+ app_info name value: 'Smalltalk VTY', Character cr, Character lf.
+ app_info version value: '1.0.0', Character cr, Character lf.
+ app_info copyright value: 'GPL bla', Character cr, Character lf.
+ app_info inspect.
+
+ OSMOVTY vty_init: app_info.
+ OSMOVTY vty_read_config_file: 'foo.cfg' priv: app_info.
+ OSMOVTY telnet_init: nil priv: nil port: 4444.
+]