Documentation
¶
Index ¶
- Constants
- type Device
- type Entry
- type File
- type FuncFile
- type Namespace
- func (ns *Namespace) Attach(t *ninep.Tattach)
- func (ns *Namespace) Get(path string) (*Entry, error)
- func (ns *Namespace) HandleReq(c net.Conn)
- func (ns *Namespace) NewDir(path string, perm uint32) (err error)
- func (ns *Namespace) NewFile(path string, perm uint32, impl File) (err error)
- func (ns *Namespace) Open(t *ninep.Topen, q *ninep.Qid)
- func (ns *Namespace) Read(t *ninep.Tread, q *ninep.Qid)
- func (ns *Namespace) Serve(listen string) error
- func (ns *Namespace) Stat(t *ninep.Tstat, q *ninep.Qid)
- func (ns *Namespace) Walk(cur *ninep.Qid, next string) *ninep.Qid
- func (ns *Namespace) Write(t *ninep.Twrite, q *ninep.Qid)
- func (ns *Namespace) Wstat(t *ninep.Twstat, q *ninep.Qid)
- type NopFile
- type ReadFcn
- type Status
- type TextFile
- type WriteFcn
Constants ¶
const ( StatUNK = iota // unknown status (init) StatOK // processing active StatDEV // device failure StatNS // namespace construction failed StatSRV // can't serve namespace StatIP // invalid IP address StatWIFI // can't connect to AP StatWPA2 // WPA2 failed StatDHCP1 // DHCP request failed StatDHCP2 // no DHCP reply StatLISTEN1 // failed to create listener StatLISTEN2 // failed to initialize listener StatPORT // invalid port specified StatEXCP // exception (panic) occured )
status codes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device interface {
// LED on or off (if applicable)
LED(on bool)
// SetupListener returns a TCP listener on the given port.
// On embedded devices with WiFi connectivity the following steps are
// performed:
// 1. Connect to access point with given SSID and join with WPA2 password
// 2. Use DHCP to get a network address; query for given hostname. Assign
// IP address if DHCP fails (if IP is a valid address).
// 3. Listen to the specified TCP port
// Devices with running TCP/IP stack can skip steps 1. and 2. in their
// implementation.
SetupListener(host, ip, ssid, passwd string, port uint16) (lst net.Listener, state int)
}
Device is a hardware abstraction
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry in the filesystem
type File ¶
type File interface {
Read(offset uint64, count uint32) ([]byte, error)
Write(offset uint64, data []byte) (uint32, error)
}
File interface for file handler implementations: The interface methods are called by the 9p protocol handler on demand. The implementation is free to handle the read/write calls according to its own logic.
type FuncFile ¶ added in v0.0.2
type FuncFile struct {
NopFile
// contains filtered or unexported fields
}
FuncFile content is returned by a function.
func NewFuncFile ¶ added in v0.0.2
NewFuncFile with specified function.
type Namespace ¶
type Namespace struct {
ninep.NopFS // use default handlers where needed
// contains filtered or unexported fields
}
Namespace is a synthetic filesystem.
func NewNamespace ¶
NewNamespace creates a new filesystem (with root directory) for the given user and group. All subdirectories and files belong to the same owner and group. If required, the ownership can be redefined on an entry with the SetOwner() method of an entry.
func (*Namespace) Read ¶
Read from entry. Either return the content of a file or the listing from a directory.
type NopFile ¶ added in v0.0.2
type NopFile struct{}
NopFile ignores all read/write requests
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status handler. Show current status depending on hardware device.
type TextFile ¶ added in v0.0.2
type TextFile struct {
NopFile
// contains filtered or unexported fields
}
TextFile with (small) static text content.
func NewTextFile ¶ added in v0.0.2
NewTextFile with given text content.