Stefan Thomanek wrote:> Hi everyone.
>
> I've read through the archives and found a few posts about using the
PXE
> stack, but none of these really helped me.
> What i want to do is: Prompt the user for 2 values, desired hostname and
> a "pin" (just a number) and send this information
> over UDP to my server
> The problem is not the user input but the UDP part.
>
> I've tried to change the code from the post of jesse barker (6.1.2007):
>
> // code start
> s_PXENV_UDP_WRITE args;
>
> memset(&args, 0, sizeof(args));
>
> args.ip = inet_addr("255.255.255.255"); // inet_addr working
here?
Yes, that should be an inet address.
> args.gw = inet_addr("0.0.0.0");
> args.src_port = 4711;
For what it's worth, Syslinux itself uses port numbers between 49152 and
57343.
> args.dst_port = 4799;
> args.buffer_size = <some sizeof() code>
> args.buffer = <some stuff to put my data in>
For the buffer you have to be a bit careful... the buffer is in 16-bit
segment-offset format, so you need to copy your data into the bounce
buffer, and then use SEG() and OFFS() to generate pointers to the data.
> memcpy(__com32.cs_bounce, &args, sizeof(args);
>
> inputRegs.es = SEG(__com32.cs_bounce);
> inputRegs.edi.w[0] = OFFS(__com32.cs_bounce);
> inputRegs.eax.w[0] = 0x0009; /* call PXE stack */
> inputRegs.ebx.w[0] = 0x0033; /* PXENV_UDP_WRITE opcode */
>
> __intcall(0x22, &inputRegs, NULL);
> // code end
>
> Could anyone give me a hand on that?
> Or is there any example already where a UDP write is used?
>
What is it you're having problems with? What you have above seems
reasonably complete.
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.