blob: 5040de02ff4fa1d95df5be103ae8089153be08ce [file] [log] [blame]
Harald Welte4f361fc2009-02-15 15:32:53 +00001#ifndef _IPACCESS_H
2#define _IPACCESS_H
3
Holger Hans Peter Freyther0e7b0732009-10-22 15:48:59 +02004#include "e1_input.h"
Holger Hans Peter Freyther4a98cad2009-12-30 05:56:49 +01005#include "linuxlist.h"
Holger Hans Peter Freyther0e7b0732009-10-22 15:48:59 +02006
Harald Welte87ed5cd2009-12-23 22:47:53 +01007#define IPA_TCP_PORT_OML 3002
8#define IPA_TCP_PORT_RSL 3003
9
Harald Welte4f361fc2009-02-15 15:32:53 +000010struct ipaccess_head {
Sylvain Munautd7d1c992009-10-29 16:33:59 +010011 u_int16_t len; /* network byte order */
Harald Welte4f361fc2009-02-15 15:32:53 +000012 u_int8_t proto;
13 u_int8_t data[0];
14} __attribute__ ((packed));
15
16enum ipaccess_proto {
17 IPAC_PROTO_RSL = 0x00,
18 IPAC_PROTO_IPACCESS = 0xfe,
Holger Hans Peter Freytherf734a142009-09-30 06:26:38 +020019 IPAC_PROTO_SCCP = 0xfd,
Harald Welte4f361fc2009-02-15 15:32:53 +000020 IPAC_PROTO_OML = 0xff,
21};
22
23enum ipaccess_msgtype {
24 IPAC_MSGT_PING = 0x00,
25 IPAC_MSGT_PONG = 0x01,
26 IPAC_MSGT_ID_GET = 0x04,
27 IPAC_MSGT_ID_RESP = 0x05,
28 IPAC_MSGT_ID_ACK = 0x06,
29};
30
31enum ipaccess_id_tags {
32 IPAC_IDTAG_SERNR = 0x00,
33 IPAC_IDTAG_UNITNAME = 0x01,
34 IPAC_IDTAG_LOCATION1 = 0x02,
35 IPAC_IDTAG_LOCATION2 = 0x03,
36 IPAC_IDTAG_EQUIPVERS = 0x04,
37 IPAC_IDTAG_SWVERSION = 0x05,
38 IPAC_IDTAG_IPADDR = 0x06,
39 IPAC_IDTAG_MACADDR = 0x07,
40 IPAC_IDTAG_UNIT = 0x08,
41};
42
Holger Hans Peter Freyther34e97492009-08-10 07:54:02 +020043int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
44
Holger Hans Peter Freytherd5f05222009-08-18 10:05:45 +020045/*
46 * methods for parsing and sending a message
47 */
48int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd);
49struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error);
50void ipaccess_prepend_header(struct msgb *msg, int proto);
51
Holger Hans Peter Freyther4a98cad2009-12-30 05:56:49 +010052/*
53 * Firmware specific header
54 */
55struct sdp_firmware {
56 char magic[4];
57 char more_magic[2];
58 u_int16_t more_more_magic;
59 u_int32_t header_length;
60 u_int32_t file_length;
61 char sw_part[20];
62 char text1[64];
63 char time[12];
64 char date[14];
65 char text2[10];
66 char version[20];
67 u_int8_t dummy[2];
68 u_int16_t part_length;
69 /* stuff i don't know */
70} __attribute__((packed));
71
72struct sdp_header {
73 struct sdp_firmware firmware_info;
74 struct llist_head list;
75};
76
77int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned base_offset, struct llist_head *list);
78
Harald Welte4f361fc2009-02-15 15:32:53 +000079#endif /* _IPACCESS_H */