Commit 6814c60e authored by Greg Williams's avatar Greg Williams
Browse files

Added support to Makefile for proper BSD sockets API inclusion within c99

parent 3fcdfdb3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ UTIL_EXEC = $(BIN_DIR)/$(PROJECT)-util
CC = gcc
OPTIMIZE = -O3
WARN = -Wall -Wextra -pedantic
#CDEFS += 
# This is necessary because the library depends on
# both C99 _and_ POSIX (for the BSD sockets API).
CDEFS += -D_POSIX_C_SOURCE=1
CFLAGS += -std=c99 -g ${WARN} ${CDEFS} ${OPTIMIZE}

LIB_INCS = -I$(LIB_DIR) -I$(PUB_INC) -I$(PBC_INC) -I$(VND_INC)
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@
  :test_preprocess:
    - *common_defines
    - TEST
  :release:
    - *common_defines

:flags:
  :release:
+6 −3
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ bool KineticPDU_Send(KineticPDU* request)
        request->connection->socketDescriptor);

    // Populate the HMAC for the protobuf
    KineticHMAC_Init(&request->hmac, KINETIC_PROTO_SECURITY_ACL_HMACALGORITHM_HmacSHA1);
    KineticHMAC_Init(&request->hmac,
        KINETIC_PROTO_SECURITY_ACL_HMACALGORITHM_HmacSHA1);
    KineticHMAC_Populate(&request->hmac,
        &request->protoData.message.proto, request->connection->key);

@@ -182,8 +183,10 @@ bool KineticPDU_Receive(KineticPDU* const response)
    if (!KineticHMAC_Validate(response->proto, response->connection->key))
    {
        LOG("Received PDU protobuf message has invalid HMAC!");
        response->protoData.message.proto.command = &response->protoData.message.command;
        response->protoData.message.command.status = &response->protoData.message.status;
        response->protoData.message.proto.command =
            &response->protoData.message.command;
        response->protoData.message.command.status =
            &response->protoData.message.status;
        response->protoData.message.status.code = 
            KINETIC_PROTO_STATUS_STATUS_CODE_DATA_ERROR;
            
+0 −3
Original line number Diff line number Diff line
@@ -41,9 +41,6 @@
#include <netdb.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <string.h>

#include "socket99/socket99.h"

+2 −1
Original line number Diff line number Diff line
@@ -30,9 +30,10 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>

#include "socket99/socket99.h"