Translate most of g_api.cpp for the new IPC framework