DHCPOptionTrait.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. namespace HostBundle\Traits;
  3. use Doctrine\ORM\Mapping as ORM;
  4. trait DHCPOptionTrait
  5. {
  6. protected $json_dhcp_option_config;
  7. /**
  8. * @ORM\PreUpdate
  9. * @ORM\PrePersist
  10. */
  11. public function doDHCPOptionsPrePersist()
  12. {
  13. $this->setOptions(json_encode($this->getDHCPOption()));
  14. }
  15. /**
  16. * @ORM\PostLoad
  17. */
  18. public function PostLoad()
  19. {
  20. $this->setDHCPOption(json_decode($this->getOptions(), true));
  21. }
  22. function getDHCPOption()
  23. {
  24. return $this->json_dhcp_option_config;
  25. }
  26. function setDHCPOption($config)
  27. {
  28. $this->json_dhcp_option_config = $config;
  29. }
  30. function setFilename($value)
  31. {
  32. $this->json_dhcp_option_config['filename'] = $value;
  33. }
  34. function getFilename()
  35. {
  36. return @$this->json_dhcp_option_config['filename'];
  37. }
  38. function setSubnetMask($value)
  39. {
  40. $this->json_dhcp_option_config['subnet_mask'] = $value;
  41. }
  42. function getSubnetMask()
  43. {
  44. return @$this->json_dhcp_option_config['subnet_mask'];
  45. }
  46. function setTimeOffset($value)
  47. {
  48. $this->json_dhcp_option_config['time_offset'] = $value;
  49. }
  50. function getTimeOffset()
  51. {
  52. return @$this->json_dhcp_option_config['time_offset'];
  53. }
  54. function setRouters($value)
  55. {
  56. $this->json_dhcp_option_config['routers'] = $value;
  57. }
  58. function getRouters()
  59. {
  60. return @$this->json_dhcp_option_config['routers'];
  61. }
  62. function setDomainNameServers($value)
  63. {
  64. $this->json_dhcp_option_config['domain_name_servers'] = $value;
  65. }
  66. function getDomainNameServers()
  67. {
  68. return @$this->json_dhcp_option_config['domain_name_servers'];
  69. }
  70. function setHostName($value)
  71. {
  72. $this->json_dhcp_option_config['host_name'] = $value;
  73. }
  74. function getHostName()
  75. {
  76. return @$this->json_dhcp_option_config['host_name'];
  77. }
  78. function setDomainName($value)
  79. {
  80. $this->json_dhcp_option_config['domain_name'] = $value;
  81. }
  82. function getDomainName()
  83. {
  84. return @$this->json_dhcp_option_config['domain_name'];
  85. }
  86. function setBroadcastAddress($value)
  87. {
  88. $this->json_dhcp_option_config['broadcast_address'] = $value;
  89. }
  90. function getBroadcastAddress()
  91. {
  92. return @$this->json_dhcp_option_config['broadcast_address'];
  93. }
  94. function setDefaultLeaseTime($value)
  95. {
  96. $this->json_dhcp_option_config['default_lease_time'] = $value;
  97. }
  98. function getDefaultLeaseTime()
  99. {
  100. return @$this->json_dhcp_option_config['default_lease_time'];
  101. }
  102. function setMaxLeaseTime($value)
  103. {
  104. $this->json_dhcp_option_config['max_lease_time'] = $value;
  105. }
  106. function getMaxLeaseTime()
  107. {
  108. return @$this->json_dhcp_option_config['max_lease_time'];
  109. }
  110. function setNextServer($value)
  111. {
  112. $this->json_dhcp_option_config['next_server'] = $value;
  113. }
  114. function getNextServer()
  115. {
  116. return @$this->json_dhcp_option_config['next_server'];
  117. }
  118. function setTftpServerName($value)
  119. {
  120. $this->json_dhcp_option_config['tftp_server'] = $value;
  121. }
  122. function getTftpServerName()
  123. {
  124. return @$this->json_dhcp_option_config['tftp_server'];
  125. }
  126. function setOption122DhcpServer($value)
  127. {
  128. $this->json_dhcp_option_config['option122.dhcp-server'] = $value;
  129. }
  130. function getOption122DhcpServer()
  131. {
  132. return @$this->json_dhcp_option_config['option122.dhcp-server'];
  133. }
  134. function setOption122DhcpServerSecondary($value)
  135. {
  136. $this->json_dhcp_option_config['option122.dhcp-server-secondary'] = $value;
  137. }
  138. function getOption122DhcpServerSecondary()
  139. {
  140. return @$this->json_dhcp_option_config['option122.dhcp-server-secondary'];
  141. }
  142. function setOption122ProvisioningServer($value)
  143. {
  144. $this->json_dhcp_option_config['option122.provisioning-server'] = $value;
  145. }
  146. function getOption122ProvisioningServer()
  147. {
  148. return @$this->json_dhcp_option_config['option122.provisioning-server'];
  149. }
  150. function setOption122ProvisioningType($value)
  151. {
  152. $this->json_dhcp_option_config['option122.provisioning-type'] = $value;
  153. }
  154. function getOption122ProvisioningType()
  155. {
  156. return @$this->json_dhcp_option_config['option122.provisioning-type'];
  157. }
  158. function setLogServers($value)
  159. {
  160. $this->json_dhcp_option_config['log_servers'] = $value;
  161. }
  162. function getLogServers()
  163. {
  164. return @$this->json_dhcp_option_config['log_servers'];
  165. }
  166. function setTimeServers($value)
  167. {
  168. $this->json_dhcp_option_config['time_servers'] = $value;
  169. }
  170. function getTimeServers()
  171. {
  172. return @$this->json_dhcp_option_config['time_servers'];
  173. }
  174. function setFixedAddress($value)
  175. {
  176. $this->json_dhcp_option_config['fixed_address'] = $value;
  177. }
  178. function getFixedAddress()
  179. {
  180. return @$this->json_dhcp_option_config['fixed_address'];
  181. }
  182. }