const.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package dhcp
  15. const (
  16. // DHCP client architecture values
  17. // - https://datatracker.ietf.org/doc/html/rfc4578#section-2.1
  18. // - https://github.com/ipxe/ipxe/blob/236299baa32452c79a59138c44eca5fcf4a918f9/src/include/ipxe/dhcp.h#L275-L305
  19. // 0. Intel x86 PC
  20. CLIENT_ARCH_INTEL_X86PC = iota
  21. // 1. NEC/PC98
  22. CLIENT_ARCH_NEC_PC98
  23. // 2. EFI Itenium
  24. CLIENT_ARCH_EFI_ITANIUM
  25. // 3. DEC alpha
  26. CLIENT_ARCH_DEC_ALPHA
  27. // 4. Arc x86
  28. CLIENT_ARCH_ARC_X86
  29. // 5. Intel Lean Client
  30. CLIENT_ARCH_INTEL_LEAN_CLIENT
  31. // 6. EFI IA32
  32. CLIENT_ARCH_EFI_IA32
  33. // 7. EFI BC
  34. CLIENT_ARCH_EFI_BC
  35. // 8. EFI Xscale
  36. CLIENT_ARCH_EFI_XSCALE
  37. // 9. EFI x86_64
  38. CLIENT_ARCH_EFI_X86_64
  39. // 10. EFI 32-bit ARM
  40. CLIENT_ARCH_EFI_ARM32
  41. // 11. EFI 64-bit ARM
  42. CLIENT_ARCH_EFI_ARM64
  43. )
  44. const (
  45. icmpRAFakePort = int(-1111)
  46. )
  47. func IsUEFIPxeArch(arch uint16) bool {
  48. switch arch {
  49. case CLIENT_ARCH_EFI_IA32:
  50. return true
  51. case CLIENT_ARCH_EFI_BC, CLIENT_ARCH_EFI_XSCALE, CLIENT_ARCH_EFI_X86_64:
  52. return true
  53. case CLIENT_ARCH_EFI_ARM32, CLIENT_ARCH_EFI_ARM64:
  54. return true
  55. }
  56. return false
  57. }