1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! The network database.
//!
//! This module provides a placeholder implementation for some of the
//! functions included in POSIX’s (?) network database.
//!
//! For the moment, implementations here are functional in the sense that
//! they simulate an empty database. Since we are only using this for
//! parsing WKS records for the moment, this seems to be a reasonably
//! shortcut.
//!
//! Furthermore, if this gets implemented for real, it should be considered
//! whether giving out clones of the entities is really necessary.


//------------ ProtoEnt -----------------------------------------------------

pub struct ProtoEnt {
    pub name: String,
    pub aliases: Vec<String>,
    pub proto: u8,
}

impl ProtoEnt {
    pub fn by_name(name: &str) -> Option<Self> {
        let _ = name;
        None
    }

    pub fn by_number(number: u8) -> Option<Self> {
        let _ = number;
        None
    }

    pub fn iter() -> ProtoIter {
        ProtoIter
    }
}


//------------ ProtoIter ----------------------------------------------------

pub struct ProtoIter;

impl Iterator for ProtoIter {
    type Item = ProtoEnt;

    fn next(&mut self) -> Option<ProtoEnt> {
        None
    }
}
    

//------------ ServEnt ------------------------------------------------------

pub struct ServEnt {
    pub name: String,
    pub aliases: Vec<String>,
    pub port: u16,
    pub proto: String
}

impl ServEnt {
    pub fn by_name(name: &str) -> Option<Self> {
        let _ = name;
        None
    }

    pub fn by_port(port: u16) -> Option<Self> {
        let _ = port;
        None
    }

    pub fn iter() -> ServIter {
        ServIter
    }
}


//------------ ServIter ------------------------------------------------------

pub struct ServIter;

impl Iterator for ServIter {
    type Item = ServEnt;

    fn next(&mut self) -> Option<ServEnt> {
        None
    }
}