src/dnsprotocol/utils

Source   Edit  

Procs

proc addressToBinMsg(x: openArray[uint8]; ss: StringStream) {.
    ...raises: [IOError, OSError], tags: [WriteIOEffect], forbids: [].}
Turns an Address stored in x into a binary dns protocol message stored in ss. Source   Edit  
proc characterStringToBinMsg(cs: string; ss: StringStream) {.
    ...raises: [ValueError, IOError, OSError], tags: [WriteIOEffect], forbids: [].}
Turns a Character-String stored in cs into a binary dns protocol message stored in ss. Source   Edit  
proc domainNameToBinMsg(name: string; ss: StringStream;
                        dictionary: var Table[string, uint16]) {.
    ...raises: [ValueError, IOError, OSError, KeyError], tags: [WriteIOEffect],
    forbids: [].}
Turns a Domain Name stored in name into a binary dns protocol message stored in ss. Source   Edit  
proc parseCharacterString(cs: var string; ss: StringStream) {.
    ...raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
Parses a Character-String contained in ss binary dns protocol message and stores it in cs. Source   Edit  
proc parseCharacterStrings(css: var seq[string]; ss: StringStream; rdlength: int) {.
    ...raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
Parses a Character-Strings contained in ss binary dns protocol message and stores it in css. Source   Edit  
proc parseDomainName(name: var string; ss: StringStream) {.
    ...raises: [IOError, OSError, ValueError], tags: [ReadIOEffect], forbids: [].}

Parses a Domain Name contained in ss binary dns protocol message and stores it in name.

Note

  • name will always have its last character as a '.', which is the root of the domain name.
Source   Edit