1
0
Fork 0

OsmoVTY: Add low level VTY code.

This commit is contained in:
Holger Hans Peter Freyther 2010-09-11 14:12:00 +08:00
parent 1070089e90
commit de142cc23c
1 changed files with 49 additions and 0 deletions

49
OsmoVTY.st Normal file
View File

@ -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.
]