Refactoring of C stubs for protobufs and ret status.