| 1 |
package com.github.markusbernhardt.proxy.search.wpad.dhcp; |
| 2 |
|
| 3 |
import java.io.ByteArrayInputStream; |
| 4 |
import java.io.ByteArrayOutputStream; |
| 5 |
import java.io.DataInputStream; |
| 6 |
import java.io.DataOutputStream; |
| 7 |
import java.io.IOException; |
| 8 |
import java.net.InetAddress; |
| 9 |
import java.net.UnknownHostException; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public class DHCPMessage { |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public static final byte OP_REQUEST = 1; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public static final byte OP_REPLY = 2; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public static final byte DHCPDISCOVER = 1; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public static final byte DHCPOFFER = 2; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
public static final byte DHCPREQUEST = 3; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
public static final byte DHCPDECLINE = 4; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public static final byte DHCPACK = 5; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public static final byte DHCPNAK = 6; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public static final byte DHCPRELEASE = 7; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
public static final byte DHCPINFORM = 8; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public static final int CLIENT_PORT = 68; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public static final int SERVER_PORT = 67; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public static InetAddress BROADCAST_ADDR = null; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
private byte op; |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
private byte htype; |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
private byte hlen; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
private byte hops; |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
private int xid; |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
private short secs; |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
private short flags; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
private byte ciaddr[] = new byte[4]; |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
private byte yiaddr[] = new byte[4]; |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
private byte siaddr[] = new byte[4]; |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
private byte giaddr[] = new byte[4]; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
private byte chaddr[] = new byte[16]; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
private byte sname[] = new byte[64]; |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
private byte file[] = new byte[128]; |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
private DHCPOptions optionsList = null; |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
private int gPort; |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
private InetAddress destination_IP; |
| 184 |
|
| 185 |
static { |
| 186 |
try { |
| 187 |
BROADCAST_ADDR = InetAddress.getByName("255.255.255.255"); |
| 188 |
|
| 189 |
} catch (UnknownHostException e) { |
| 190 |
|
| 191 |
} |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
public DHCPMessage() { |
| 204 |
initialize(); |
| 205 |
|
| 206 |
this.destination_IP = BROADCAST_ADDR; |
| 207 |
this.gPort = SERVER_PORT; |
| 208 |
} |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
public DHCPMessage(DHCPMessage inMessage) { |
| 217 |
initialize(); |
| 218 |
|
| 219 |
this.destination_IP = BROADCAST_ADDR; |
| 220 |
this.gPort = SERVER_PORT; |
| 221 |
this.op = inMessage.getOp(); |
| 222 |
this.htype = inMessage.getHtype(); |
| 223 |
this.hlen = inMessage.getHlen(); |
| 224 |
this.hops = inMessage.getHops(); |
| 225 |
this.xid = inMessage.getXid(); |
| 226 |
this.secs = inMessage.getSecs(); |
| 227 |
this.flags = inMessage.getFlags(); |
| 228 |
this.ciaddr = inMessage.getCiaddr(); |
| 229 |
this.yiaddr = inMessage.getYiaddr(); |
| 230 |
this.siaddr = inMessage.getSiaddr(); |
| 231 |
this.giaddr = inMessage.getGiaddr(); |
| 232 |
this.chaddr = inMessage.getChaddr(); |
| 233 |
this.sname = inMessage.getSname(); |
| 234 |
this.file = inMessage.getFile(); |
| 235 |
this.optionsList.internalize(inMessage.getOptions()); |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
public DHCPMessage(DHCPMessage inMessage, InetAddress inServername, int inPort) { |
| 250 |
initialize(); |
| 251 |
|
| 252 |
this.destination_IP = inServername; |
| 253 |
this.gPort = inPort; |
| 254 |
|
| 255 |
this.op = inMessage.getOp(); |
| 256 |
this.htype = inMessage.getHtype(); |
| 257 |
this.hlen = inMessage.getHlen(); |
| 258 |
this.hops = inMessage.getHops(); |
| 259 |
this.xid = inMessage.getXid(); |
| 260 |
this.secs = inMessage.getSecs(); |
| 261 |
this.flags = inMessage.getFlags(); |
| 262 |
this.ciaddr = inMessage.getCiaddr(); |
| 263 |
this.yiaddr = inMessage.getYiaddr(); |
| 264 |
this.siaddr = inMessage.getSiaddr(); |
| 265 |
this.giaddr = inMessage.getGiaddr(); |
| 266 |
this.chaddr = inMessage.getChaddr(); |
| 267 |
this.sname = inMessage.getSname(); |
| 268 |
this.file = inMessage.getFile(); |
| 269 |
this.optionsList.internalize(inMessage.getOptions()); |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
public DHCPMessage(DHCPMessage inMessage, InetAddress inServername) { |
| 281 |
initialize(); |
| 282 |
|
| 283 |
this.destination_IP = inServername; |
| 284 |
this.gPort = SERVER_PORT; |
| 285 |
|
| 286 |
this.op = inMessage.getOp(); |
| 287 |
this.htype = inMessage.getHtype(); |
| 288 |
this.hlen = inMessage.getHlen(); |
| 289 |
this.hops = inMessage.getHops(); |
| 290 |
this.xid = inMessage.getXid(); |
| 291 |
this.secs = inMessage.getSecs(); |
| 292 |
this.flags = inMessage.getFlags(); |
| 293 |
this.ciaddr = inMessage.getCiaddr(); |
| 294 |
this.yiaddr = inMessage.getYiaddr(); |
| 295 |
this.siaddr = inMessage.getSiaddr(); |
| 296 |
this.giaddr = inMessage.getGiaddr(); |
| 297 |
this.chaddr = inMessage.getChaddr(); |
| 298 |
this.sname = inMessage.getSname(); |
| 299 |
this.file = inMessage.getFile(); |
| 300 |
this.optionsList.internalize(inMessage.getOptions()); |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
public DHCPMessage(InetAddress inServername, int inPort) { |
| 313 |
initialize(); |
| 314 |
|
| 315 |
this.destination_IP = inServername; |
| 316 |
this.gPort = inPort; |
| 317 |
} |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
public DHCPMessage(InetAddress inServername) { |
| 327 |
initialize(); |
| 328 |
|
| 329 |
this.destination_IP = inServername; |
| 330 |
this.gPort = SERVER_PORT; |
| 331 |
} |
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
public DHCPMessage(int inPort) { |
| 341 |
initialize(); |
| 342 |
|
| 343 |
this.destination_IP = BROADCAST_ADDR; |
| 344 |
this.gPort = inPort; |
| 345 |
} |
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
public DHCPMessage(byte[] ibuf) { |
| 357 |
initialize(); |
| 358 |
internalize(ibuf); |
| 359 |
|
| 360 |
this.destination_IP = BROADCAST_ADDR; |
| 361 |
this.gPort = SERVER_PORT; |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
public DHCPMessage(byte[] ibuf, InetAddress inServername, int inPort) { |
| 377 |
initialize(); |
| 378 |
internalize(ibuf); |
| 379 |
|
| 380 |
this.destination_IP = inServername; |
| 381 |
this.gPort = inPort; |
| 382 |
} |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
public DHCPMessage(byte ibuf[], int inPort) { |
| 395 |
initialize(); |
| 396 |
internalize(ibuf); |
| 397 |
|
| 398 |
this.destination_IP = BROADCAST_ADDR; |
| 399 |
this.gPort = inPort; |
| 400 |
} |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
public DHCPMessage(byte[] ibuf, InetAddress inServername) { |
| 413 |
initialize(); |
| 414 |
internalize(ibuf); |
| 415 |
|
| 416 |
this.destination_IP = inServername; |
| 417 |
this.gPort = SERVER_PORT; |
| 418 |
} |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
public DHCPMessage(DataInputStream inStream) { |
| 427 |
initialize(); |
| 428 |
|
| 429 |
try { |
| 430 |
this.op = inStream.readByte(); |
| 431 |
this.htype = inStream.readByte(); |
| 432 |
this.hlen = inStream.readByte(); |
| 433 |
this.hops = inStream.readByte(); |
| 434 |
this.xid = inStream.readInt(); |
| 435 |
this.secs = inStream.readShort(); |
| 436 |
this.flags = inStream.readShort(); |
| 437 |
inStream.readFully(this.ciaddr, 0, 4); |
| 438 |
inStream.readFully(this.yiaddr, 0, 4); |
| 439 |
inStream.readFully(this.siaddr, 0, 4); |
| 440 |
inStream.readFully(this.giaddr, 0, 4); |
| 441 |
inStream.readFully(this.chaddr, 0, 16); |
| 442 |
inStream.readFully(this.sname, 0, 64); |
| 443 |
inStream.readFully(this.file, 0, 128); |
| 444 |
byte[] options = new byte[312]; |
| 445 |
inStream.readFully(options, 0, 312); |
| 446 |
this.optionsList.internalize(options); |
| 447 |
} catch (IOException e) { |
| 448 |
System.err.println(e); |
| 449 |
} |
| 450 |
} |
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
private void initialize() { |
| 461 |
this.optionsList = new DHCPOptions(); |
| 462 |
} |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
public synchronized byte[] externalize() { |
| 471 |
ByteArrayOutputStream outBStream = new ByteArrayOutputStream(); |
| 472 |
DataOutputStream outStream = new DataOutputStream(outBStream); |
| 473 |
|
| 474 |
try { |
| 475 |
outStream.writeByte(this.op); |
| 476 |
outStream.writeByte(this.htype); |
| 477 |
outStream.writeByte(this.hlen); |
| 478 |
outStream.writeByte(this.hops); |
| 479 |
outStream.writeInt(this.xid); |
| 480 |
outStream.writeShort(this.secs); |
| 481 |
outStream.writeShort(this.flags); |
| 482 |
outStream.write(this.ciaddr, 0, 4); |
| 483 |
outStream.write(this.yiaddr, 0, 4); |
| 484 |
outStream.write(this.siaddr, 0, 4); |
| 485 |
outStream.write(this.giaddr, 0, 4); |
| 486 |
outStream.write(this.chaddr, 0, 16); |
| 487 |
outStream.write(this.sname, 0, 64); |
| 488 |
outStream.write(this.file, 0, 128); |
| 489 |
|
| 490 |
byte[] options = new byte[312]; |
| 491 |
if (this.optionsList == null) { |
| 492 |
initialize(); |
| 493 |
} |
| 494 |
|
| 495 |
options = this.optionsList.externalize(); |
| 496 |
outStream.write(options, 0, 312); |
| 497 |
} catch (IOException e) { |
| 498 |
System.err.println(e); |
| 499 |
} |
| 500 |
|
| 501 |
|
| 502 |
byte data[] = outBStream.toByteArray(); |
| 503 |
|
| 504 |
return data; |
| 505 |
} |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
public synchronized DHCPMessage internalize(byte[] ibuff) { |
| 517 |
ByteArrayInputStream inBStream = new ByteArrayInputStream(ibuff, 0, ibuff.length); |
| 518 |
DataInputStream inStream = new DataInputStream(inBStream); |
| 519 |
|
| 520 |
try { |
| 521 |
this.op = inStream.readByte(); |
| 522 |
this.htype = inStream.readByte(); |
| 523 |
this.hlen = inStream.readByte(); |
| 524 |
this.hops = inStream.readByte(); |
| 525 |
this.xid = inStream.readInt(); |
| 526 |
this.secs = inStream.readShort(); |
| 527 |
this.flags = inStream.readShort(); |
| 528 |
inStream.readFully(this.ciaddr, 0, 4); |
| 529 |
inStream.readFully(this.yiaddr, 0, 4); |
| 530 |
inStream.readFully(this.siaddr, 0, 4); |
| 531 |
inStream.readFully(this.giaddr, 0, 4); |
| 532 |
inStream.readFully(this.chaddr, 0, 16); |
| 533 |
inStream.readFully(this.sname, 0, 64); |
| 534 |
inStream.readFully(this.file, 0, 128); |
| 535 |
|
| 536 |
byte[] options = new byte[312]; |
| 537 |
inStream.readFully(options, 0, 312); |
| 538 |
if (this.optionsList == null) { |
| 539 |
initialize(); |
| 540 |
} |
| 541 |
|
| 542 |
this.optionsList.internalize(options); |
| 543 |
} catch (IOException e) { |
| 544 |
System.err.println(e); |
| 545 |
} |
| 546 |
|
| 547 |
return this; |
| 548 |
} |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
public void setOp(byte inOp) { |
| 557 |
this.op = inOp; |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
public void setHtype(byte inHtype) { |
| 567 |
this.htype = inHtype; |
| 568 |
} |
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
public void setHlen(byte inHlen) { |
| 577 |
this.hlen = inHlen; |
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
public void setHops(byte inHops) { |
| 587 |
this.hops = inHops; |
| 588 |
} |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
public void setXid(int inXid) { |
| 597 |
this.xid = inXid; |
| 598 |
} |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
public void setSecs(short inSecs) { |
| 609 |
this.secs = inSecs; |
| 610 |
} |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
public void setFlags(short inFlags) { |
| 619 |
this.flags = inFlags; |
| 620 |
} |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
public void setCiaddr(byte[] inCiaddr) { |
| 629 |
this.ciaddr = inCiaddr; |
| 630 |
} |
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
public void setYiaddr(byte[] inYiaddr) { |
| 639 |
this.yiaddr = inYiaddr; |
| 640 |
} |
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
public void setSiaddr(byte[] inSiaddr) { |
| 649 |
this.siaddr = inSiaddr; |
| 650 |
} |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
public void setGiaddr(byte[] inGiaddr) { |
| 659 |
this.giaddr = inGiaddr; |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
public void setChaddr(byte[] inChaddr) { |
| 669 |
this.chaddr = inChaddr; |
| 670 |
} |
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
public void setSname(byte[] inSname) { |
| 679 |
this.sname = inSname; |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
public void setFile(byte[] inFile) { |
| 689 |
this.file = inFile; |
| 690 |
} |
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
public void setPort(int inPortNum) { |
| 699 |
this.gPort = inPortNum; |
| 700 |
} |
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
public void setDestinationHost(String inHost) { |
| 709 |
try { |
| 710 |
this.destination_IP = InetAddress.getByName(inHost); |
| 711 |
} catch (Exception e) { |
| 712 |
System.err.println(e); |
| 713 |
} |
| 714 |
} |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
public byte getOp() { |
| 720 |
return this.op; |
| 721 |
} |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
public byte getHtype() { |
| 727 |
return this.htype; |
| 728 |
} |
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
public byte getHlen() { |
| 734 |
return this.hlen; |
| 735 |
} |
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
public byte getHops() { |
| 741 |
return this.hops; |
| 742 |
} |
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
public int getXid() { |
| 748 |
return this.xid; |
| 749 |
} |
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
public short getSecs() { |
| 756 |
return this.secs; |
| 757 |
} |
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
public short getFlags() { |
| 763 |
return this.flags; |
| 764 |
} |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
public byte[] getCiaddr() { |
| 770 |
return this.ciaddr; |
| 771 |
} |
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
public byte[] getYiaddr() { |
| 777 |
return this.yiaddr; |
| 778 |
} |
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
public byte[] getSiaddr() { |
| 784 |
return this.siaddr; |
| 785 |
} |
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
public byte[] getGiaddr() { |
| 791 |
return this.giaddr; |
| 792 |
} |
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
public byte[] getChaddr() { |
| 798 |
return this.chaddr; |
| 799 |
} |
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
|
| 804 |
public byte[] getSname() { |
| 805 |
return this.sname; |
| 806 |
} |
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
public byte[] getFile() { |
| 812 |
return this.file; |
| 813 |
} |
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
public byte[] getOptions() { |
| 819 |
if (this.optionsList == null) { |
| 820 |
initialize(); |
| 821 |
} |
| 822 |
return this.optionsList.externalize(); |
| 823 |
} |
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
public int getPort() { |
| 829 |
return this.gPort; |
| 830 |
} |
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
public String getDestinationAddress() { |
| 839 |
return this.destination_IP.getHostAddress(); |
| 840 |
} |
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
public void setOption(int inOptNum, byte[] inOptionData) { |
| 852 |
this.optionsList.setOption((byte) inOptNum, inOptionData); |
| 853 |
} |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
public byte[] getOption(int inOptNum) { |
| 865 |
if (this.optionsList == null) { |
| 866 |
initialize(); |
| 867 |
} |
| 868 |
return this.optionsList.getOption((byte) inOptNum); |
| 869 |
} |
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
public void removeOption(int inOptNum) { |
| 878 |
if (this.optionsList == null) { |
| 879 |
initialize(); |
| 880 |
} |
| 881 |
this.optionsList.removeOption((byte) inOptNum); |
| 882 |
} |
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
public boolean IsOptSet(int inOptNum) { |
| 893 |
if (this.optionsList == null) { |
| 894 |
initialize(); |
| 895 |
} |
| 896 |
|
| 897 |
return this.optionsList.contains((byte) inOptNum); |
| 898 |
} |
| 899 |
} |