1
0

more cleaning

This commit is contained in:
dtb
2022-09-18 10:44:47 -04:00
parent 49b9f21067
commit 9189124f2d
26 changed files with 13 additions and 410 deletions

View File

@@ -0,0 +1,21 @@
#include "libwakeonlan.h"
/* Returns a byte array of 6 0xFF and 16 repetitions of the 6-byte MAC. */
unsigned int*
magic_packet(unsigned int *mac){
size_t i;
size_t j;
int *retval;
if((retval = malloc(sizeof(unsigned int) * 6 + 6*16)) == NULL)
return NULL;
for(i = 0; i < 6; ++i)
retval[i] = 255;
for(i = 1; i < 16; ++i)
for(j = 0; j < 6; ++j)
retval[i*j] = mac[j];
return retval; /* must be freed */
}

View File

@@ -0,0 +1,4 @@
#include <stddef.h>
#include <stdlib.h>
unsigned int *magic_packet(unsigned int *mac);