netatalk 4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
server_ipc.c File Reference
`#include <errno.h>`
`#include <pthread.h>`
`#include <signal.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/socket.h>`
`#include <sys/types.h>`
`#include <sys/un.h>`
`#include <time.h>`
`#include <unistd.h>`
`#include <atalk/dsi.h>`
`#include <atalk/errchk.h>`
`#include <atalk/globals.h>`
`#include <atalk/logger.h>`
`#include <atalk/server_child.h>`
`#include <atalk/server_ipc.h>`
`#include <atalk/util.h>`

## Data Structures
struct | ipc_header

## Macros
#define | IPC_HEADERLEN 14
#define | IPC_MAXMSGSIZE 90

## Typedefs
typedef struct ipc_header | ipc_header_t

## Functions
static int | ipc_kill_token (struct ipc_header *ipc, server_child_t *children)
| Pass afp_socket to old disconnected session matching the random session token.
static int | ipc_session_token (struct ipc_header *ipc, server_child_t *children)
static int | ipc_get_session (struct ipc_header *ipc, server_child_t *children)
static int | ipc_login_done (const struct ipc_header *ipc, server_child_t *children)
static int | ipc_set_state (struct ipc_header *ipc, server_child_t *children)
static int | ipc_set_volumes (struct ipc_header *ipc, server_child_t *children)
int | ipc_server_read (server_child_t *children, int fd)
| Read a IPC message from a child.
int | ipc_child_write (int fd, uint16_t command, int len, void *msg)
int | ipc_child_state (AFPObj *obj, uint16_t state)

## Variables
static char * | ipc_cmd_str []

## Detailed Description

IPC over socketpair between parent and children.

## Macro Definition Documentation

## ◆ IPC_HEADERLEN

#define IPC_HEADERLEN 14

## ◆ IPC_MAXMSGSIZE

#define IPC_MAXMSGSIZE 90

## Typedef Documentation

## ◆ ipc_header_t

typedef struct ipc_header ipc_header_t

## Function Documentation

## ◆ ipc_child_state()

int ipc_child_state | ( | AFPObj * | obj,
|  | uint16_t | state )

## ◆ ipc_child_write()

int ipc_child_write | ( | int | fd,
|  | uint16_t | command,
|  | int | len,
|  | void * | msg )

## ◆ ipc_get_session()

int ipc_get_session | ( | struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

## ◆ ipc_kill_token()

int ipc_kill_token | ( | struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

Pass afp_socket to old disconnected session matching the random session token.

Returns
  -1 on error, 0 if no matching session was found, 1 if session was found and socket passed

## ◆ ipc_login_done()

int ipc_login_done | ( | const struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

## ◆ ipc_server_read()

int ipc_server_read | ( | server_child_t * | children,
|  | int | fd )

Read a IPC message from a child.

This is using an fd with non-blocking IO, so EAGAIN is not an error

Parameters

  [in,out] | children | pointer to our structure with all childs
  [in] | fd | IPC socket with child

Returns
  -1 on error, 0 on success

## ◆ ipc_session_token()

int ipc_session_token | ( | struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

## ◆ ipc_set_state()

int ipc_set_state | ( | struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

## ◆ ipc_set_volumes()

int ipc_set_volumes | ( | struct ipc_header * | ipc,
|  | server_child_t * | children )
| static

## Variable Documentation

## ◆ ipc_cmd_str

char* ipc_cmd_str[]
| static

Initial value:
= { "IPC_DISCOLDSESSION",
"IPC_GETSESSION",
"IPC_STATE",
"IPC_VOLUMES",
"IPC_LOGINDONE",
"IPC_SESSIONTOKEN"
}