[24319] | 1 | /* $Id: mr_private.h 3956 2010-01-05 20:56:56Z zacheiss $ |
---|
[23095] | 2 | * |
---|
| 3 | * Private declarations of the Moira library. |
---|
| 4 | * |
---|
| 5 | * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology |
---|
| 6 | * For copying and distribution information, please see the file |
---|
| 7 | * <mit-copyright.h>. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include <mit-copyright.h> |
---|
| 11 | #include <moira.h> |
---|
| 12 | |
---|
| 13 | #include <sys/types.h> |
---|
| 14 | |
---|
| 15 | #ifndef _WIN32 |
---|
| 16 | #include <netinet/in.h> |
---|
| 17 | #include <arpa/inet.h> |
---|
| 18 | #endif /*_WIN32*/ |
---|
| 19 | |
---|
| 20 | extern int _mr_conn, mr_inited; |
---|
| 21 | |
---|
| 22 | typedef struct mr_params { |
---|
| 23 | union { |
---|
| 24 | u_long mr_procno; /* for call */ |
---|
| 25 | u_long mr_status; /* for reply */ |
---|
| 26 | } u; |
---|
| 27 | int mr_argc; |
---|
| 28 | char **mr_argv; |
---|
| 29 | int *mr_argl; |
---|
| 30 | unsigned char *mr_flattened; |
---|
| 31 | u_long mr_filled; |
---|
| 32 | } mr_params; |
---|
| 33 | |
---|
| 34 | #define CHECK_CONNECTED if (!_mr_conn) return MR_NOT_CONNECTED |
---|
| 35 | |
---|
| 36 | #define getlong(cp, l) do { l = ((((unsigned char *)cp)[0] * 256 + ((unsigned char *)cp)[1]) * 256 + ((unsigned char *)cp)[2]) * 256 + ((unsigned char *)cp)[3]; } while(0) |
---|
| 37 | #define putlong(cp, l) do { ((unsigned char *)cp)[0] = (unsigned char)(l >> 24); ((unsigned char *)cp)[1] = (unsigned char)(l >> 16); ((unsigned char *)cp)[2] = (unsigned char)(l >> 8); ((unsigned char *)cp)[3] = (unsigned char)(l); } while(0) |
---|
| 38 | |
---|
| 39 | /* prototypes from mr_call.h */ |
---|
| 40 | int mr_do_call(struct mr_params *params, struct mr_params *reply); |
---|
| 41 | int mr_send(int fd, struct mr_params *params); |
---|
| 42 | int mr_receive(int fd, struct mr_params *params); |
---|
| 43 | int mr_cont_receive(int fd, struct mr_params *params); |
---|
| 44 | void mr_destroy_reply(mr_params reply); |
---|
| 45 | |
---|
| 46 | /* prototypes from mr_connect.h */ |
---|
| 47 | int mr_accept(int s, struct sockaddr_in *sin); |
---|
| 48 | int mr_cont_accept(int conn, char **buf, int *nread); |
---|
| 49 | int mr_connect_internal(char *server, char *port); |
---|
| 50 | int mr_listen(char *port); |
---|
| 51 | |
---|
| 52 | /* prototypes from mr_init.c */ |
---|
| 53 | void mr_init(void); |
---|