Getting to work on raspi

This commit is contained in:
Cameron Tacklind 2022-08-23 15:06:50 -07:00
parent 6464a3648f
commit 25de694682
3 changed files with 27 additions and 3 deletions

View File

@ -167,7 +167,14 @@ PackB4(u8* ptr, u32 val)
ptr[2] = (u8)((val & 0xff00) >> 8);
ptr[1] = (u8)((val & 0xff0000) >> 16);
ptr[0] = (u8)((val & 0xff000000) >> 24);
return ptr + sizeof(val);
return ptr + sizeof(val);
}
//Unpacks a u32 from a known big endian buffer
u32
UpackB4(u8* ptr)
{
return (u32)(ptr[3] | (ptr[2] << 8) | (ptr[1] << 16) | (ptr[0] << 24));
}
internal void
@ -398,7 +405,14 @@ sacn_string_to_cid(String str)
internal u32
sacn_universe_to_send_addr(u32 universe)
{
return 0;
u8 multicast_address_buffer[4] = {};
multicast_address_buffer[0] = 239;
multicast_address_buffer[1] = 255;
multicast_address_buffer[2] = (u8)((universe & 0xff00) >> 8); // high bit
multicast_address_buffer[3] = (u8)((universe & 0x00ff)); // low bit
u32 v4_addr = (u32)UpackB4(multicast_address_buffer);
return v4_addr;
}
internal u8*
@ -421,6 +435,8 @@ output_network_sacn_init()
(u8*)&ttl, sizeof(ttl)
);
printf("Registered SACN Socket\n");
return (u8*)result;
}

View File

@ -62,6 +62,14 @@ os_socket_send_to(Socket_Handle handle, u32 addr, u32 port, Data data, s32 flags
.sin_port = hton_u16(port),
.sin_addr.s_addr = hton_u32(addr),
};
#define PRINT_EVERY_SEND_ADDR 0
#if PRINT_EVERY_SEND_ADDR
printf("Sending To:\n\tFamily: %d\n\tPort: %d\n\tAddr: %d\n",
dst.sin_family, dst.sin_port, dst.sin_addr.s_addr
);
#endif
struct sockaddr* dst_ptr = (struct sockaddr*)&dst;
s32 len_sent = sendto(sock, data.base, data.size, flags, dst_ptr, sizeof(struct sockaddr_in));
if (len_sent == -1)

View File

@ -41,7 +41,7 @@ linux_err_print_(char* proc, char* sub_proc, s32 errsv)
#include "../shared/lumenarium_shared_network.h"
#include "../linux/lumenarium_linux_file.h"
#include "../linux/lumenarium_linux_time.h"
#include "../linux/lumenarium_linux_network.h"
#include "../osx/lumenarium_osx_network.h"
int main (int arg_count, char** args)