1/* orckit_quirks.c ...... fix quirks in orckit adsl modems 2 * mulix <mulix@actcom.co.il> 3 * 4 * $Id: orckit_quirks.c,v 1.3 2002/03/01 01:23:36 quozl Exp $ 5 */ 6 7#include <string.h> 8#include <sys/types.h> 9#include <netinet/in.h> 10#include "pptp_msg.h" 11#include "pptp_options.h" 12#include "pptp_ctrl.h" 13#include "util.h" 14 15 16 17/* return 0 on success, non zero otherwise */ 18int 19orckit_atur3_build_hook(struct pptp_out_call_rqst* packet) 20{ 21 unsigned int name_length = 10; 22 23 struct pptp_out_call_rqst fixed_packet = { 24 PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST), 25 0, /* hton16(call->callid) */ 26 0, /* hton16(call->sernum) */ 27 hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX), 28 hton32(PPTP_BEARER_DIGITAL), hton32(PPTP_FRAME_ANY), 29 hton16(PPTP_WINDOW), 0, hton16(name_length), 0, 30 {'R','E','L','A','Y','_','P','P','P','1',0}, {0} 31 }; 32 33 if (!packet) 34 return -1; 35 36 memcpy(packet, &fixed_packet, sizeof(*packet)); 37 38 return 0; 39} 40 41/* return 0 on success, non zero otherwise */ 42int 43orckit_atur3_set_link_hook(struct pptp_set_link_info* packet, 44 int peer_call_id) 45{ 46 struct pptp_set_link_info fixed_packet = { 47 PPTP_HEADER_CTRL(PPTP_SET_LINK_INFO), 48 hton16(peer_call_id), 49 0, 50 0xffffffff, 51 0xffffffff}; 52 53 if (!packet) 54 return -1; 55 56 memcpy(packet, &fixed_packet, sizeof(*packet)); 57 return 0; 58} 59 60/* return 0 on success, non 0 otherwise */ 61int 62orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet) 63{ 64 struct pptp_start_ctrl_conn fixed_packet = { 65 {0}, /* we'll set the header later */ 66 hton16(PPTP_VERSION), 0, 0, 67 hton32(PPTP_FRAME_ASYNC), hton32(PPTP_BEARER_ANALOG), 68 hton16(0) /* max channels */, 69 hton16(0x6021), 70 {'R','E','L','A','Y','_','P','P','P','1',0}, /* hostname */ 71 {'M','S',' ','W','i','n',' ','N','T',0} /* vendor */ 72 }; 73 74 if (!packet) 75 return -1; 76 77 /* grab the header from the original packet, since we dont 78 know if this is a request or a reply */ 79 memcpy(&fixed_packet.header, &packet->header, sizeof(struct pptp_header)); 80 81 /* and now overwrite the full packet, effectively preserving the header */ 82 memcpy(packet, &fixed_packet, sizeof(*packet)); 83 return 0; 84} 85 86 87