// File: billDrett[P]Bulletin-Boards/boardServer.cpp
// Function: BoardServer::BoardServer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
BoardServer::BoardServer(string C2S, string S2C, string BP2S, string S2BP)
{
    if((pipeClient2Server = open(C2S.c_str(), O_RDWR)) < 0) //isws kai O_NONBLOCK
    {
        perror("fifo C2S not found");
        exit(1);
    }

    if((pipeServer2Client = open(S2C.c_str(), O_WRONLY)) < 0)
    {
        perror("fifo S2C not found");
        exit(1);
    }

    if((pipeBoardPost2Server = open(BP2S.c_str(), O_RDWR)) < 0)
    {
        perror("fifo BP2S not found");
        exit(1);
    }

    /*if((pipeServer2BoardPost = open(S2BP.c_str(), O_WRONLY)) < 0)
    {
        perror("fifo S2BP not found");
    }*/
    pipeServer2BoardPost = -1; //tha to anoiksw otan xreiastei na kanw to write
    this->Server2BoardPost = S2BP.c_str(); //apothikeuw to onoma sto opoio vrisketai


    chanels = new List<Chanel>;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rsi, -0x40(%rbp)
movq %rdx, -0x68(%rbp)
movq %rcx, -0x60(%rbp)
movq %r8, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
addq $0x10, %rdi
movq %rdi, -0x48(%rbp)
callq 0x33e0
movq -0x40(%rbp), %rdi
callq 0x3130
movq %rax, %rdi
xorl %eax, %eax
movl $0x2, %esi
callq 0x3230
movl %eax, -0x38(%rbp)
jmp 0x5b11
movl -0x38(%rbp), %eax
movq -0x50(%rbp), %rcx
movl %eax, (%rcx)
cmpl $0x0, %eax
jge 0x5b48
leaq 0x5560(%rip), %rdi      # 0xb086
callq 0x3260
jmp 0x5b2d
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x5c40
movq -0x68(%rbp), %rdi
callq 0x3130
movq %rax, %rdi
xorl %eax, %eax
movl $0x1, %esi
callq 0x3230
movl %eax, -0x6c(%rbp)
jmp 0x5b65
movl -0x6c(%rbp), %eax
movq -0x50(%rbp), %rcx
movl %eax, 0x4(%rcx)
cmpl $0x0, %eax
jge 0x5b8c
leaq 0x551e(%rip), %rdi      # 0xb099
callq 0x3260
jmp 0x5b82
movl $0x1, %edi
callq 0x3370
movq -0x60(%rbp), %rdi
callq 0x3130
movq %rax, %rdi
xorl %eax, %eax
movl $0x2, %esi
callq 0x3230
movl %eax, -0x70(%rbp)
jmp 0x5ba9
movl -0x70(%rbp), %eax
movq -0x50(%rbp), %rcx
movl %eax, 0x8(%rcx)
cmpl $0x0, %eax
jge 0x5bd0
leaq 0x5609(%rip), %rdi      # 0xb1c8
callq 0x3260
jmp 0x5bc6
movl $0x1, %edi
callq 0x3370
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rdi
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
callq 0x3130
movq -0x50(%rbp), %rdi
movq %rax, %rsi
addq $0x10, %rdi
callq 0x33d0
jmp 0x5bf6
movl $0x18, %edi
callq 0x32d0
movq %rax, -0x78(%rbp)
jmp 0x5c06
movq -0x78(%rbp), %rdi
callq 0xa1b0
jmp 0x5c11
movq -0x50(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x30(%rax)
addq $0x80, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x18, %esi
callq 0x32e0
movq -0x48(%rbp), %rdi
callq 0x31f0
movq -0x30(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)