When you receive a netiso_cmd (16 bytes) from the PS3, you first check the opcode.
For NETISO_CMD_OPEN_DIR (0x122A) you call this function with cmd (16 bytes) using the struct below:
ret = process_open_dir_cmd(index, (netiso_open_dir_cmd *)&cmd);
The dp_len tells the amount of bytes to read after the command.
ret = recv(s, (void *)dirpath, dp_len, 0);
The received path is translated to the local path. e.g. if your shared folder is /shared
if dp_len = 7 and receive "/PS3ISO", the path is translated to /shared/PS3ISO
Then send a response of 0 or -1 to the PS3 in this struct:
The directory entries are returned as response of the netiso_cmd NETISO_CMD_READ_DIR (0x1232)
ret = process_read_dir_cmd(index, (netiso_read_dir_entry_cmd *)&cmd);
For NETISO_CMD_OPEN_DIR (0x122A) you call this function with cmd (16 bytes) using the struct below:
ret = process_open_dir_cmd(index, (netiso_open_dir_cmd *)&cmd);
Code:
typedef struct _netiso_open_dir_cmd
{
uint16_t opcode;
uint16_t dp_len; // dirpath length
uint8_t pad[12];
} __attribute__((packed)) netiso_open_dir_cmd;
The dp_len tells the amount of bytes to read after the command.
ret = recv(s, (void *)dirpath, dp_len, 0);
The received path is translated to the local path. e.g. if your shared folder is /shared
if dp_len = 7 and receive "/PS3ISO", the path is translated to /shared/PS3ISO
Then send a response of 0 or -1 to the PS3 in this struct:
Code:
typedef struct _netiso_open_dir_result
{
int32_t open_result; // 0 success, -1 error
} __attribute__((packed)) netiso_open_dir_result;
The directory entries are returned as response of the netiso_cmd NETISO_CMD_READ_DIR (0x1232)
ret = process_read_dir_cmd(index, (netiso_read_dir_entry_cmd *)&cmd);