00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _DATAGRAM_FNC_H
00029 #define _DATAGRAM_FNC_H
00030
00031 #include <stdio.h>
00032 #include <stdarg.h>
00033 #include <errno.h>
00034 #include "../../ip_addr.h"
00035 #include "../../str.h"
00036 #include "../../dprint.h"
00037 #include "../../ut.h"
00038 #include "../../lib/kmi/mi.h"
00039 #include "../../mem/mem.h"
00040 #include "../../mem/shm_mem.h"
00041
00042 #include "mi_datagram.h"
00043
00044 #define MI_COMMAND_FAILED "500 command failed\n"
00045 #define MI_COMMAND_FAILED_LEN (sizeof(MI_COMMAND_FAILED)-1)
00046 #define MI_COMMAND_NOT_AVAILABLE "500 command not available\n"
00047 #define MI_COMMAND_AVAILABLE_LEN (sizeof(MI_COMMAND_NOT_AVAILABLE)-1)
00048 #define MI_PARSE_ERROR "400 parse error in command\n"
00049 #define MI_PARSE_ERROR_LEN (sizeof(MI_PARSE_ERROR)-1)
00050 #define MI_INTERNAL_ERROR "500 Internal server error\n"
00051 #define MI_INTERNAL_ERROR_LEN (sizeof(MI_INTERNAL_ERROR)-1)
00052
00053
00054
00055 typedef struct datagram_str{
00056 char * start, * current;
00057 int len;
00058 }datagram_stream;
00059
00060 typedef struct rx_tx{
00061 int rx_sock, tx_sock;
00062 }rx_tx_sockets;
00063
00064
00065 int mi_init_datagram_server(sockaddr_dtgram * address, unsigned int domain,
00066 rx_tx_sockets * socks,int mode,
00067 int uid, int gid );
00068 int mi_init_datagram_buffer(void);
00069 void mi_datagram_server(int rx_sock, int tx_sock);
00070 #endif