?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2. ;@                                                                            @
  3. ;@                           SymbOS network daemon                            @
  4. ;@                              N S L O O K U P                               @
  5. ;@                                                                            @
  6. ;@               (c) 2015 by Prodatron / SymbiosiS (JЎrn Mika)                @
  7. ;@                                                                            @
  8. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  9.  
  10.  
  11. ;### PRGPRZ -> Programm-Prozess
  12. prgprz  call SyShell_PARALL     ;get commandline parameters
  13.         push de
  14.         call SyShell_PARSHL     ;fetch shell-specific parameters
  15.         jp c,prgend
  16.         ld hl,nsltxttit         ;title text
  17.         ld e,0
  18.         call SyShell_STROUT
  19.         jp c,prgend
  20.         pop de
  21.         ld a,d
  22.         cp 1                    ;exactly 1 parameter (domain name) is required
  23.         ld hl,nsltxtpar
  24.         jp nz,prgend0
  25.  
  26.         call SyNet_NETINI               ;***** INIT NETWORK API (SEARCH FOR THE DAEMON)
  27.         ld hl,nsltxtdmn
  28.         jr c,prgend0            ;no daemon found -> error
  29.  
  30.         ld hl,nsltxtdns
  31.         ld e,0
  32.         call SyShell_STROUT
  33.  
  34.         call prgdns
  35.         jr prgend
  36.  
  37. ;### PRGEND -> Programm beenden
  38. prgend0 ld e,0
  39.         call SyShell_STROUT
  40. prgend  ld e,0
  41.         call SyShell_EXIT       ;tell Shell, that process will quit
  42.         ld hl,(App_BegCode+prgpstnum)
  43.         call SySystem_PRGEND
  44. prgend1 rst #30
  45.         jr prgend1
  46.  
  47. ;### PRGERR -> display DNS error message
  48. prgerr  ld hl,nsltxterr
  49.         sub 16
  50.         jr c,prgend0
  51.         cp 4+1
  52.         jr nc,prgend0
  53.         add a
  54.         ld c,a
  55.         ld b,0
  56.         ld hl,nsldnstab
  57.         add hl,bc
  58.         ld a,(hl)
  59.         inc hl
  60.         ld h,(hl)
  61.         ld l,a
  62.         jr prgend0
  63.  
  64. ;### PRGDNS -> DNS resolve
  65. prgdns  ld hl,(SyShell_CmdParas+0)
  66.         call SyNet_DNSRSV               ;***** DNS RESOLVE
  67.         jr c,prgerr             ;lookup failed -> error
  68.         ld hl,nsltxtipa+12
  69.         ld e,"."
  70.         db #dd:ld a,l:call clcn08:ld (hl),e:inc hl
  71.         db #dd:ld a,h:call clcn08:ld (hl),e:inc hl
  72.         db #fd:ld a,l:call clcn08:ld (hl),e:inc hl
  73.         db #fd:ld a,h:call clcn08:ld (hl),0
  74.         ld hl,nsltxtipa:ld e,0:call SyShell_STROUT
  75.         ld hl,nsltxtlfd:ld e,0:call SyShell_STROUT
  76.         ret
  77.  
  78.  
  79. nsltxttit   db 13,10
  80.             db "NSLOOKUP 1.0 (c)oded 2015 by Prodatron",13,10,0
  81. nsltxtdns   db "Send DNS request",13,10,0
  82. nsltxtipt   db "X-type",13,10,0
  83. nsltxtipa   db "IP address: xxx.xxx.xxx.xxx",0
  84.  
  85. nsltxtpar   db "Wrong or missing parameter",13,10
  86.             db "NSLOOKUP <domainname>",13,10,0
  87. nsltxtdmn   db "Network daemon not running!",13,10,0
  88.  
  89. nsltxtlfd   db 13,10,13,10,0
  90.  
  91. nsldnstab   dw nsldnstxt1,nsldnstxt2,nsldnstxt3,nsldnstxt4,nsldnstxt5
  92. nsldnstxt1  db "Invalid domain string",13,10,0
  93. nsldnstxt2  db "Request timeout",13,10,0
  94. nsldnstxt3  db "Recursion currently not supported",13,10,0
  95. nsldnstxt4  db "Truncated answer",13,10,0
  96. nsldnstxt5  db "Package too large",13,10,0
  97.  
  98. nsltxterr   db "Error",13,10,0
  99.  
  100. neterrdiv   equ 16  ;dns - invalid domain string
  101. neterrdto   equ 17  ;dns - timeout
  102. neterrdrc   equ 18  ;dns - recursion not supported
  103. neterrdtr   equ 19  ;dns - truncated answer
  104. neterrdln   equ 20  ;dns - package too large
  105.  
  106.  
  107. ;==============================================================================
  108. ;### SUB-ROUTINEN #############################################################
  109. ;==============================================================================
  110.  
  111. ;### CLCN08 -> Converst 8bit value into ASCII string (0-terminated)
  112. ;### Input      A=Value, HL=Destination
  113. ;### Output     HL=points behind last digit
  114. ;### Destroyed  AF,BC
  115. clcn08  cp 10
  116.         jr c,clcn082
  117.         cp 100
  118.         jr c,clcn081
  119.         ld c,100
  120.         call clcn083
  121. clcn081 ld c,10
  122.         call clcn083
  123. clcn082 add "0"
  124.         ld (hl),a
  125.         inc hl
  126.         ld (hl),0
  127.         ret
  128. clcn083 ld b,"0"-1
  129. clcn084 sub c
  130.         inc b
  131.         jr nc,clcn084
  132.         add c
  133.         ld (hl),b
  134.         inc hl
  135.         ret
  136.  
  137.  
  138. ;==============================================================================
  139. ;### DATEN-TEIL ###############################################################
  140. ;==============================================================================
  141.  
  142. App_BegData
  143.  
  144. ;### nothing (more) here
  145. db 0
  146.  
  147. ;==============================================================================
  148. ;### TRANSFER-TEIL ############################################################
  149. ;==============================================================================
  150.  
  151. App_BegTrns
  152. ;### PRGPRZS -> Stack f№r Programm-Prozess
  153.             ds 64
  154. prgstk      ds 6*2
  155.             dw prgprz
  156. App_PrcID   db 0
  157. App_MsgBuf  ds 14
  158.